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

Unified Diff: src/core/SkBitmap.cpp

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 | « include/core/SkBitmap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 9227906eab643a60d51e008d0a1d631176c81419..c0232fda2eab415e47345258985e0fe912e3f969 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -549,6 +549,23 @@ bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb,
return true;
}
+bool SkBitmap::allocConfigPixels(Config config, int width, int height,
+ bool isOpaque) {
+ SkColorType ct;
+ if (!config_to_colorType(config, &ct)) {
+ return false;
+ }
+
+ SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
+ if (!validate_alphaType(config, at, &at)) {
+ return false;
+ }
+
+ return this->allocPixels(SkImageInfo::Make(width, height, ct, at));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
void SkBitmap::freePixels() {
// if we're gonna free the pixels, we certainly need to free the mipmap
this->freeMipMap();
« no previous file with comments | « include/core/SkBitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698