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

Unified Diff: include/core/SkBitmap.h

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « gm/xfermodes3.cpp ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index af0c8b87e7a643fbf7fbf7b193fcb53b8ffcf010..8059e262f3d4c7d13abf864f52826ae80578fc28 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -267,7 +267,21 @@ public:
bool allocPixels(const SkImageInfo& info) {
return this->allocPixels(info, NULL, NULL);
}
-
+
+ /**
+ * Legacy helper function, which creates an SkImageInfo from the specified
+ * config and then calls allocPixels(info).
+ */
+ bool allocConfigPixels(Config, int width, int height, bool isOpaque = false);
+
+ bool allocN32Pixels(int width, int height, bool isOpaque = false) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
+ if (isOpaque) {
+ info.fAlphaType = kOpaque_SkAlphaType;
+ }
+ return this->allocPixels(info);
+ }
+
/**
* Install a pixelref that wraps the specified pixels and rowBytes, and
* optional ReleaseProc and context. When the pixels are no longer
« no previous file with comments | « gm/xfermodes3.cpp ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698