Break up SkLazyPixelRef functionally into class hierarchy.
The reason for this CL is to allow greater decoder flexibility.
Chrome currently uses its own decoding functions. These allow for
greater flexibility in dealing with images with multiple frames or
partial data. The DecodeProc function was not flexible enough to
handle these. Instead of asking the decoder to squeeze everything
into the DecodeProc, we now ask the downstream library to inherit from
SkCachingPixelRef. If WebKit's LazyDecodingPixelRef is re-tooled to
inherit from SkCachingPixelRef, then it can make use of Skia's caching
ability while still allowing it to deal with multiple frames, scaling,
subsetting, and partial data.
- The abstract SkCachingPixelRef class handles caching the decoded
data in a SkScaledImageCache. This class relies on the virtual
functions onDecodeInfo() and onDecode() to do the actual decoding
- The SkLazyCachingPixelRef class is derived from SkCachingPixelRef.
It provides an implementation of onDecodeInfo() and onDecode() in
terms of calls to a SkBitmapFactory::DecodeProc function. It also
provides an Install() static method which installs a new
SkLazyCachingPixelRef into a SkBitmap.
SkLazyCachingPixelRef exists for two reasons: to test
SkCachingPixelRef within Skia and as an example for downstream
developers to make their own classes that inherit from
- The CachedDecodingPixelRefTest was updated to test the
SkLazyCachingPixelRef class and indirectly the SkCachingPixelRef
Review URL: https://codereview.chromium.org/54203006
git-svn-id: http://skia.googlecode.com/svn/trunk/include@12149 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkBitmap.h b/core/SkBitmap.h
index 59b6482..64f2e24 100644
@@ -17,6 +17,7 @@
@@ -259,6 +260,7 @@
+ bool setConfig(const SkImageInfo& info, size_t rowBytes = 0);
/** Use this to assign a new pixel address for an existing bitmap. This
will automatically release any pixelref previously installed. Only call
diff --git a/core/SkImage.h b/core/SkImage.h
index 97dc799..ae8bbf5 100644
@@ -47,6 +47,9 @@
+bool operator==(const SkImageInfo& lhs, const SkImageInfo& rhs);
+bool operator!=(const SkImageInfo& lhs, const SkImageInfo& rhs);
* SkImage is an abstraction for drawing a rectagle of pixels, though the
* particular type of image could be actually storing its data on the GPU, or