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

Unified Diff: include/core/SkImage.h

Issue 1208993017: Add image->bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add check for immutable Created 5 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/image/SkImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 41a1bd85272f163bb5e5a2135ad353ff92cf897b..65b9c9cb92fe02521587ada2a8f393ec28ea5070 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -264,6 +264,24 @@ public:
SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset = NULL,
SkFilterQuality = kNone_SkFilterQuality) const;
+ // Helper functions to convert to SkBitmap
+
+ enum LegacyBitmapMode {
+ kRO_LegacyBitmapMode,
+ kRW_LegacyBitmapMode,
+ };
+
+ /**
+ * Attempt to create a bitmap with the same pixels as the image. The result will always be
+ * a raster-backed bitmap (texture-backed bitmaps are DEPRECATED, and not supported here).
+ *
+ * If the mode is kRO (read-only), the resulting bitmap will be marked as immutable.
+ *
+ * On succcess, returns true. On failure, returns false and the bitmap parameter will be reset
+ * to empty.
+ */
+ bool asLegacyBitmap(SkBitmap*, LegacyBitmapMode) const;
+
protected:
SkImage(int width, int height) :
fWidth(width),
« no previous file with comments | « no previous file | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698