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

Issue 7060052: Create SkLazyPixelRef which performs lazy decoding and caching. (Closed)

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

Description

Create SkLazyPixelRef which performs lazy decoding. The new pixel ref behaves similarly to SkImageRef, with some key differences: It does not depend on the images project. It requires an SkImageCache, which handles allocation and caching of the pixel memory. It takes a function signature for decoding which decodes into already allocated pixel memory rather than into an SkBitmap. Add two implementations of SkImageCache: SkLruImageCache and SkAshmemImageCache. Replace SkSerializationHelpers::DecodeBitmap with SkPicture::InstallPixelRefProc, and update sites that referenced it. SkBitmapFactory now sets the pixel ref to a new object of the new class SkLazyPixelRef, provided it has an SkImageCache for caching. Provide an option to do lazy decodes in render_pictures and bench_pictures. SkPicture: Eliminate the default parameters in the constructor. If a proc for decoding bitmaps is installed, use it to decode any encoded data in subpictures. When parsing deserializing subpictures, check for success. When serializing subpictures, pass the picture's bitmap encoder to the subpicture's call to serialize. Update BitmapFactoryTest to test its new behavior. BUG=https://code.google.com/p/skia/issues/detail?id=1008 BUG=https://code.google.com/p/skia/issues/detail?id=1009 Committed: https://code.google.com/p/skia/source/detail?r=7835

Patch Set 1 #

Total comments: 4

Patch Set 2 : Update two more call sites of the removed function pointer. #

Patch Set 3 : Respond to comments #

Total comments: 2

Patch Set 4 : Respond to comments #

Total comments: 12

Patch Set 5 : Create a BitmapFactory object. #

Patch Set 6 : Separate decoder from SkBitmap and add SkImageCache #

Patch Set 7 : Adds a PNG decoder and Ashmem image cache #

Patch Set 8 : Don't use a factory for SkDecoder on Mac. #

Patch Set 9 : #

Total comments: 10

Patch Set 10 : Restructuring #

Patch Set 11 : Cleanups #

Patch Set 12 : Move files into a separate folder and make SkLazyPixelRef hidden in src. #

Total comments: 16

Patch Set 13 : Respond to comments #

Total comments: 4

Patch Set 14 : Respond to comments, picture fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1268 lines, -187 lines) Patch
M debugger/QT/SkDebuggerGUI.cpp View 1 2 3 4 5 6 7 8 9 6 chunks +7 lines, -11 lines 0 comments Download
M gm/factory.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -1 line 0 comments Download
M gyp/animator.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -3 lines 0 comments Download
M gyp/core.gyp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
M gyp/core.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +10 lines, -0 lines 0 comments Download
M gyp/images.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +4 lines, -2 lines 0 comments Download
M gyp/ports.gyp View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M gyp/tests.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M gyp/views.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +5 lines, -4 lines 0 comments Download
M gyp/views_animated.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +7 lines, -6 lines 0 comments Download
M include/core/SkPicture.h View 1 2 3 4 5 6 7 8 9 3 chunks +31 lines, -6 lines 0 comments Download
M include/core/SkSerializationHelpers.h View 1 2 3 4 5 6 1 chunk +0 lines, -9 lines 0 comments Download
D include/images/SkBitmapFactory.h View 1 2 3 4 6 7 8 1 chunk +0 lines, -46 lines 0 comments Download
M include/images/SkImageDecoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +30 lines, -0 lines 0 comments Download
A include/lazy/SkBitmapFactory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +86 lines, -0 lines 0 comments Download
A include/lazy/SkImageCache.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +76 lines, -0 lines 0 comments Download
A include/lazy/SkLruImageCache.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +74 lines, -0 lines 0 comments Download
A include/ports/SkAshmemImageCache.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +73 lines, -0 lines 0 comments Download
M samplecode/SamplePictFile.cpp View 1 2 3 4 5 1 chunk +1 line, -2 lines 0 comments Download
M src/core/SkOrderedReadBuffer.h View 1 2 3 4 5 6 7 8 9 3 chunks +8 lines, -6 lines 0 comments Download
M src/core/SkOrderedReadBuffer.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -7 lines 0 comments Download
M src/core/SkPicture.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +11 lines, -3 lines 0 comments Download
M src/core/SkPicturePlayback.h View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -3 lines 0 comments Download
M src/core/SkPicturePlayback.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +24 lines, -10 lines 0 comments Download
D src/images/SkBitmapFactory.cpp View 1 2 3 4 6 7 8 1 chunk +0 lines, -41 lines 0 comments Download
M src/images/SkImageDecoder.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +64 lines, -1 line 0 comments Download
A src/lazy/SkBitmapFactory.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +79 lines, -0 lines 0 comments Download
A src/lazy/SkLazyPixelRef.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +63 lines, -0 lines 0 comments Download
A src/lazy/SkLazyPixelRef.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +107 lines, -0 lines 0 comments Download
A src/lazy/SkLruImageCache.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +189 lines, -0 lines 0 comments Download
A src/ports/SkAshmemImageCache.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +155 lines, -0 lines 0 comments Download
M tests/BitmapFactoryTest.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +56 lines, -17 lines 0 comments Download
M tools/bench_pictures_main.cpp View 1 2 3 4 5 6 7 8 9 7 chunks +33 lines, -4 lines 0 comments Download
M tools/filtermain.cpp View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M tools/render_pdfs_main.cpp View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M tools/render_pictures_main.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +45 lines, -3 lines 0 comments Download

Messages

Total messages: 17
Leon
11 years, 4 months ago (2013-01-07 20:39:20 UTC) #1
reed1
just a comment on SkLazyPixelRef.h (so far) https://codereview.appspot.com/7060052/diff/1/include/core/SkLazyPixelRef.h File include/core/SkLazyPixelRef.h (right): https://codereview.appspot.com/7060052/diff/1/include/core/SkLazyPixelRef.h#newcode29 include/core/SkLazyPixelRef.h:29: * onLockPixels ...
11 years, 4 months ago (2013-01-07 21:33:45 UTC) #2
Leon
https://codereview.appspot.com/7060052/diff/1/include/core/SkLazyPixelRef.h File include/core/SkLazyPixelRef.h (right): https://codereview.appspot.com/7060052/diff/1/include/core/SkLazyPixelRef.h#newcode29 include/core/SkLazyPixelRef.h:29: * onLockPixels to set the pixels properly. On 2013/01/07 ...
11 years, 4 months ago (2013-01-07 22:15:15 UTC) #3
reed1
Is it clearer if we move the function-ptr defs into SkBitmap.h? e.g. typedef SkData* (*EncodeProc)(const ...
11 years, 4 months ago (2013-01-08 22:34:23 UTC) #4
Leon
> Is it clearer if we move the function-ptr defs into SkBitmap.h? > > e.g. ...
11 years, 4 months ago (2013-01-09 20:50:49 UTC) #5
Leon
New patch. I've updated the description, and removed you as a reviewer from my other ...
11 years, 4 months ago (2013-01-10 18:31:19 UTC) #6
reed1
https://codereview.appspot.com/7060052/diff/7003/include/core/SkBitmap.h File include/core/SkBitmap.h (right): https://codereview.appspot.com/7060052/diff/7003/include/core/SkBitmap.h#newcode590 include/core/SkBitmap.h:590: * Function signature defining a function that sets up ...
11 years, 4 months ago (2013-01-10 19:03:34 UTC) #7
Leon
https://codereview.appspot.com/7060052/diff/7003/include/core/SkBitmap.h File include/core/SkBitmap.h (right): https://codereview.appspot.com/7060052/diff/7003/include/core/SkBitmap.h#newcode590 include/core/SkBitmap.h:590: * Function signature defining a function that sets up ...
11 years, 4 months ago (2013-01-11 17:52:04 UTC) #8
Leon
Based on your verbal feedback, I have made numerous changes to this CL. I have ...
11 years, 3 months ago (2013-02-14 22:57:39 UTC) #9
reed1
Wow, this has become a big CL. It is possible to show just a CL ...
11 years, 3 months ago (2013-02-15 15:56:22 UTC) #10
Leon
> Wow, this has become a big CL. It is possible to show just a ...
11 years, 3 months ago (2013-02-19 16:31:46 UTC) #11
reed1
https://codereview.appspot.com/7060052/diff/43001/include/core/SkImageCache.h File include/core/SkImageCache.h (right): https://codereview.appspot.com/7060052/diff/43001/include/core/SkImageCache.h#newcode29 include/core/SkImageCache.h:29: */ intptr_t instead of int32_t
11 years, 3 months ago (2013-02-20 15:57:11 UTC) #12
Leon
New CL up for review. The latest addresses our discussion the other day: the decode ...
11 years, 2 months ago (2013-02-21 22:23:56 UTC) #13
reed1
really close, nice work. not clear that lazy is the perfect name for the directory, ...
11 years, 2 months ago (2013-02-22 17:10:02 UTC) #14
Leon
https://codereview.appspot.com/7060052/diff/78001/include/core/SkImage.h File include/core/SkImage.h (right): https://codereview.appspot.com/7060052/diff/78001/include/core/SkImage.h#newcode69 include/core/SkImage.h:69: * for this size. On 2013/02/22 17:10:02, reed1 wrote: ...
11 years, 2 months ago (2013-02-22 18:43:58 UTC) #15
reed1
lgtm w/ two requests to move public things to more private/secluded ones https://codereview.appspot.com/7060052/diff/88001/include/core/SkImage.h File include/core/SkImage.h ...
11 years, 2 months ago (2013-02-22 20:17:54 UTC) #16
Leon
11 years, 2 months ago (2013-02-22 21:37:48 UTC) #17
https://codereview.appspot.com/7060052/diff/88001/include/core/SkImage.h
File include/core/SkImage.h (right):

https://codereview.appspot.com/7060052/diff/88001/include/core/SkImage.h#newc...
include/core/SkImage.h:70: */
On 2013/02/22 20:17:54, reed1 wrote:
> Can we move this guy to be private-impl for lazypixelref.cpp?

Done.

https://codereview.appspot.com/7060052/diff/88001/include/core/SkImage.h#newc...
include/core/SkImage.h:75: */
On 2013/02/22 20:17:54, reed1 wrote:
> Can we move this into bitmapfactory.h?

Done.
Sign in to reply to this message.

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