Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: include/core/SkImageDecoder.h

Issue 19109002: Add the lazy decoder from PictureFlags to SkImageDecoder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove unnecessary dependency Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/images/SkImageDecoder.cpp » ('j') | src/images/SkImageDecoder.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageDecoder.h
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index 191fe53f4c588a0584486fee25b68ee7a2c7ab1f..8cb4881b40e7a139c7e029fff9249fc56e24e7cd 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -13,6 +13,7 @@
#include "SkBitmap.h"
#include "SkBitmapFactory.h"
#include "SkImage.h"
+#include "SkLruImageCache.h"
#include "SkRect.h"
#include "SkRefCnt.h"
#include "SkTypes.h"
@@ -97,6 +98,13 @@ public:
*/
bool getRequireUnpremultipliedColors() const { return fRequireUnpremultipliedColors; }
+ /**
+ * Returns a pointer to the LRU cache used by LazyDecodeBitmap.
+ */
+ static SkLruImageCache* getLruImageCache() {
scroggo 2013/07/15 15:09:28 This does not generally relate to SkImageDecoder,
+ return &fLruImageCache;
scroggo 2013/07/15 15:09:28 SkImageDecoder.h is built by chromium, but SkImage
+ }
+
/** \class Peeker
Base class for optional callbacks to retrieve meta/chunk data out of
@@ -308,6 +316,11 @@ public:
}
/**
+ * Decode the image with DecodeMemoryToTarget but defer the process until it is needed.
+ */
+ static bool LazyDecodeBitmap(const void* buffer, size_t size, SkBitmap* bitmap);
scroggo 2013/07/15 15:09:28 I support moving LazyDecodeBitmap to a header file
+
+ /**
* Decode memory.
* @param info Output parameter. Returns info about the encoded image.
* @param target Contains the address of pixel memory to decode into
@@ -468,6 +481,10 @@ private:
mutable bool fShouldCancelDecode;
bool fPreferQualityOverSpeed;
bool fRequireUnpremultipliedColors;
+
+ static SkLruImageCache fLruImageCache;
+ static SkBitmapFactory fLazyBitmapFactory;
+
};
/** Calling newDecoder with a stream returns a new matching imagedecoder
« no previous file with comments | « no previous file | src/images/SkImageDecoder.cpp » ('j') | src/images/SkImageDecoder.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698