Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(967)

Issue 6551071: Allow PNG encoding/decoding during SkPicture serialization. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 9 months ago by Leon
Modified:
11 years, 8 months ago
Reviewers:
DerekS, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlecode.com/svn/trunk
Visibility:
Public.

Description

Add the ability to provide function pointers to SkPicture serialization and deserialization for encoding and decoding bitmaps. Remove kForceFlattenBitmapPixels_Flag, which is no longer used. When an SkOrderedReadBuffer needs to read a bitmap, if it does not have an image decoder, use a dummy bitmap. In GM, add a tolerance option for color differences, used when testing picture serialization, so it can assume two images are the same even though PNG encoding/decoding may have resulted in small differences. Create dummy implementations for SkImageDecoder and SkImageEncoder functions in SkImageDecoder_empty so that a project that does not want to include the images project it can still build. Allow ports to build without images project. In Mac's image encoder, copy 4444 to 8888 before encoding. Add SkWriter32::reservePad, to provide a pointer to write non 4 byte aligned data, padded with zeroes. In bench_ and render_ pictures, pass decode function to SkPicture creation from a stream. BUG=https://code.google.com/p/skia/issues/detail?id=842 Committed: https://code.google.com/p/skia/source/detail?r=5818

Patch Set 1 #

Total comments: 1

Patch Set 2 : #

Total comments: 10

Patch Set 3 : Respond to comments. #

Patch Set 4 : Only copy from 4444 to 8888 for PNG encoding. #

Patch Set 5 : Remove all dependency of core on images. #

Total comments: 2

Patch Set 6 : Add comments; pass Decode to render_ and bench_ pictures. #

Patch Set 7 : Rebase; fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -132 lines) Patch
M gm/gmmain.cpp View 1 2 3 4 9 chunks +27 lines, -14 lines 0 comments Download
M gyp/images.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkFlattenableBuffers.h View 1 2 3 4 2 chunks +0 lines, -9 lines 0 comments Download
M include/core/SkPicture.h View 1 2 3 4 3 chunks +9 lines, -2 lines 0 comments Download
A include/core/SkSerializationHelpers.h View 1 2 3 4 5 1 chunk +35 lines, -0 lines 0 comments Download
M include/core/SkWriter32.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
A + include/images/SkImages.h View 2 chunks +6 lines, -5 lines 0 comments Download
M src/core/SkOrderedReadBuffer.h View 1 2 3 4 3 chunks +13 lines, -1 line 0 comments Download
M src/core/SkOrderedReadBuffer.cpp View 1 2 3 4 4 chunks +27 lines, -5 lines 0 comments Download
M src/core/SkOrderedWriteBuffer.h View 1 2 3 4 5 3 chunks +13 lines, -0 lines 0 comments Download
M src/core/SkOrderedWriteBuffer.cpp View 1 2 3 4 5 6 4 chunks +36 lines, -6 lines 0 comments Download
M src/core/SkPicture.cpp View 1 2 3 4 5 6 4 chunks +6 lines, -5 lines 0 comments Download
M src/core/SkPicturePlayback.h View 1 2 3 4 3 chunks +6 lines, -3 lines 0 comments Download
M src/core/SkPicturePlayback.cpp View 1 2 3 4 6 chunks +8 lines, -4 lines 0 comments Download
M src/core/SkWriter32.cpp View 1 2 1 chunk +10 lines, -3 lines 0 comments Download
A src/images/SkImages.cpp View 1 chunk +16 lines, -0 lines 0 comments Download
M src/ports/SkGlobalInitialization_default.cpp View 3 chunks +2 lines, -5 lines 0 comments Download
M src/ports/SkImageDecoder_CG.cpp View 1 2 3 4 5 6 2 chunks +14 lines, -1 line 0 comments Download
M src/ports/SkImageDecoder_empty.cpp View 1 2 3 4 1 chunk +39 lines, -67 lines 0 comments Download
M tools/bench_pictures_main.cpp View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download
M tools/render_pictures_main.cpp View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 10
Leon
https://codereview.appspot.com/6551071/diff/1/include/images/SkImages.h File include/images/SkImages.h (left): https://codereview.appspot.com/6551071/diff/1/include/images/SkImages.h#oldcode11 include/images/SkImages.h:11: const GrGLInterface* SkDebugGLContext::createGLContext() { I am not sure why ...
11 years, 9 months ago (2012-09-24 20:23:50 UTC) #1
reed1
Will comment separately on how we can make the Codecs available to our core-code... https://codereview.appspot.com/6551071/diff/1001/src/core/SkOrderedWriteBuffer.cpp ...
11 years, 9 months ago (2012-09-24 20:52:18 UTC) #2
DerekS
https://codereview.appspot.com/6551071/diff/1001/src/core/SkOrderedReadBuffer.cpp File src/core/SkOrderedReadBuffer.cpp (right): https://codereview.appspot.com/6551071/diff/1001/src/core/SkOrderedReadBuffer.cpp#newcode168 src/core/SkOrderedReadBuffer.cpp:168: if (this->readBool()) { instead of a bool should we ...
11 years, 9 months ago (2012-09-24 20:53:18 UTC) #3
reed1
Unorganized thoughts on Codecs and how they hook in: 1. Writer could stick a function-ptr ...
11 years, 9 months ago (2012-09-24 21:06:53 UTC) #4
Leon
> Unorganized thoughts on Codecs and how they hook in: > > 1. Writer could ...
11 years, 9 months ago (2012-09-25 16:20:35 UTC) #5
DerekS
I'm ok with the current way of converting the bitmap to PNG and if we ...
11 years, 9 months ago (2012-09-25 17:27:03 UTC) #6
Leon
Latest patch allows the reader and writer to provide function pointers for encoding and decoding.
11 years, 9 months ago (2012-09-27 18:25:47 UTC) #7
reed1
I like, at least as something we can try out. Some questions for dox https://codereview.appspot.com/6551071/diff/9004/include/core/SkSerializationHelpers.h ...
11 years, 9 months ago (2012-09-27 18:28:52 UTC) #8
Leon
https://codereview.appspot.com/6551071/diff/9004/include/core/SkSerializationHelpers.h File include/core/SkSerializationHelpers.h (right): https://codereview.appspot.com/6551071/diff/9004/include/core/SkSerializationHelpers.h#newcode16 include/core/SkSerializationHelpers.h:16: namespace SkSerializationHelpers { On 2012/09/27 18:28:52, reed1 wrote: > ...
11 years, 9 months ago (2012-09-27 19:17:53 UTC) #9
reed1
11 years, 9 months ago (2012-09-27 20:26:55 UTC) #10
thanks for the dox.

Thinking more, we may want to change it later to allow some state for the
caller, so a base-class of some kind will be more useful than just a
function-ptr, but I think this is a fine start.

lgtm
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b