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

Unified Diff: gm/xfermodes2.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 | « gm/xfermodes.cpp ('k') | gm/xfermodes3.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/xfermodes2.cpp
diff --git a/gm/xfermodes2.cpp b/gm/xfermodes2.cpp
index 046c3ddc2af47dc8d9ad25e3e94f66fc3de1a65e..6202af9a724c6103f9354488dc3d587fc89c8b26 100644
--- a/gm/xfermodes2.cpp
+++ b/gm/xfermodes2.cpp
@@ -93,9 +93,7 @@ private:
SkPackARGB32(0xFF, 0x40, 0x40, 0x40)
};
SkBitmap bg;
- bg.setConfig(SkBitmap::kARGB_8888_Config, 2, 2, 0, kOpaque_SkAlphaType);
- bg.allocPixels();
- SkAutoLockPixels bgAlp(bg);
+ bg.allocN32Pixels(2, 2, true);
memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData));
fBG.reset(SkShader::CreateBitmapShader(bg,
@@ -106,9 +104,7 @@ private:
fBG->setLocalMatrix(lm);
SkBitmap dstBmp;
- dstBmp.setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
- dstBmp.allocPixels();
- SkAutoLockPixels dstAlp(dstBmp);
+ dstBmp.allocN32Pixels(kSize, kSize);
SkPMColor* pixels = reinterpret_cast<SkPMColor*>(dstBmp.getPixels());
for (int y = 0; y < kSize; ++y) {
@@ -122,9 +118,7 @@ private:
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode));
SkBitmap srcBmp;
- srcBmp.setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
- srcBmp.allocPixels();
- SkAutoLockPixels srcAlp(srcBmp);
+ srcBmp.allocN32Pixels(kSize, kSize);
pixels = reinterpret_cast<SkPMColor*>(srcBmp.getPixels());
for (int x = 0; x < kSize; ++x) {
« no previous file with comments | « gm/xfermodes.cpp ('k') | gm/xfermodes3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698