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

Unified Diff: skia/ext/image_operations_unittest.cc

Issue 159381: Attempt to fix the ImageOperations::CreateMaskedBitmap UMR by bringing the un... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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 | « skia/ext/image_operations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/image_operations_unittest.cc
===================================================================
--- skia/ext/image_operations_unittest.cc (revision 21606)
+++ skia/ext/image_operations_unittest.cc (working copy)
@@ -202,19 +202,20 @@
SkBitmap alpha;
alpha.setConfig(SkBitmap::kARGB_8888_Config, src_w, src_h);
alpha.allocPixels();
-
- unsigned char* src_data =
- reinterpret_cast<unsigned char*>(alpha.getAddr32(0, 0));
- for (int i = 0; i < src_w * src_h; i++) {
- src_data[i * 4] = SkColorSetARGB(i + 128 % 255,
- i + 128 % 255,
- i + 64 % 255,
- i + 0 % 255);
+ for (int y = 0, i = 0; y < src_h; y++) {
+ for (int x = 0; x < src_w; x++) {
+ *alpha.getAddr32(x, y) = SkColorSetARGB(i + 128 % 255,
+ i + 128 % 255,
+ i + 64 % 255,
+ i + 0 % 255);
+ i++;
+ }
}
SkBitmap masked = skia::ImageOperations::CreateMaskedBitmap(src, alpha);
SkAutoLockPixels src_lock(src);
+ SkAutoLockPixels alpha_lock(alpha);
SkAutoLockPixels masked_lock(masked);
for (int y = 0; y < src_h; y++) {
for (int x = 0; x < src_w; x++) {
« no previous file with comments | « skia/ext/image_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698