aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-06 10:08:30 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-06 10:08:30 +0000
commit6e3e42296b0d7a93325146d9c9a7e23ef90760fe (patch)
tree7b9c3f75c7e8da1e5c3f0510e8173b0fdbd490bb /src/image/SkImage.cpp
parent6006d0f8c4f19d19a12de20826f731f52ac822a7 (diff)
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 of data. - 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 SkCachingPixelRef. - The CachedDecodingPixelRefTest was updated to test the SkLazyCachingPixelRef class and indirectly the SkCachingPixelRef class. BUG= R=reed@google.com, scroggo@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/54203006 git-svn-id: http://skia.googlecode.com/svn/trunk@12149 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/image/SkImage.cpp')
-rw-r--r--src/image/SkImage.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 39fd93acc6..c8559e6533 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -12,6 +12,14 @@
SK_DEFINE_INST_COUNT(SkImage)
+bool operator==(const SkImageInfo& lhs, const SkImageInfo& rhs) {
+ return 0 == memcmp(&lhs, &rhs, sizeof(SkImageInfo));
+}
+bool operator!=(const SkImageInfo& lhs, const SkImageInfo& rhs) {
+ return 0 != memcmp(&lhs, &rhs, sizeof(SkImageInfo));
+}
+
+
static SkImage_Base* as_IB(SkImage* image) {
return static_cast<SkImage_Base*>(image);
}