From f8d7d2731318cdf510ab68e6b3f5ec68ab22c8e2 Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Fri, 22 Feb 2013 21:38:35 +0000 Subject: 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 Review URL: https://codereview.appspot.com/7060052 git-svn-id: http://skia.googlecode.com/svn/trunk@7835 2bbb7eff-a529-9590-31e7-b0007b416f81 --- samplecode/SamplePictFile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'samplecode') diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp index 65279cb7a5..c82d03e3ea 100644 --- a/samplecode/SamplePictFile.cpp +++ b/samplecode/SamplePictFile.cpp @@ -48,8 +48,7 @@ class PictFileView : public SampleView { } else { SkFILEStream stream(path); if (stream.isValid()) { - pic = SkNEW_ARGS(SkPicture, - (&stream, NULL, &SkImageDecoder::DecodeStream)); + pic = SkNEW_ARGS(SkPicture, (&stream, NULL, &SkImageDecoder::DecodeMemory)); } if (false) { // re-record -- cgit v1.2.3