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

Unified Diff: include/core/SkPixelRef.h

Issue 23591030: start to remove lockPixels from bitmapshader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review suggestions Created 7 years, 3 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/core/SkBitmapProcShader.cpp » ('j') | src/core/SkBitmapProcState.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 0487e426109a2e84381e84aff4638ec0c6eccfb3..395fb93607b90a25d2f01bf21ee9b9ceb105b6d2 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -141,6 +141,21 @@ public:
return this->onRefEncodedData();
}
+ /**
+ * Return a decoded instance of this pixelRef in bitmap. If this cannot be
+ * done, return false and ignore bitmap.
+ * pow2 is the requeste power-of-two downscale that the caller needs. This
+ * can be ignored, and the "original" size can be returned, but if the
+ * underlying codec can efficiently return a smaller size, that should be
+ * done.
+ * If this returns true, then bitmap must be "locked" and point to the
+ * pixels for this pixelref.
+ */
+ bool decodeInto(int pow2, SkBitmap* bitmap) {
+ SkASSERT(pow2 >= 0);
+ return this->onDecodeInto(pow2, bitmap);
+ }
+
/** Are we really wrapping a texture instead of a bitmap?
*/
virtual GrTexture* getTexture() { return NULL; }
@@ -190,6 +205,8 @@ protected:
/** Default impl returns true */
virtual bool onLockPixelsAreWritable() const;
+ virtual bool onDecodeInto(int pow2, SkBitmap* bitmap);
+
/**
* For pixelrefs that don't have access to their raw pixels, they may be
* able to make a copy of them (e.g. if the pixels are on the GPU).
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | src/core/SkBitmapProcState.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698