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

Unified Diff: tools/picture_utils.cpp

Issue 14363003: Updates to skimage tool to use it for testing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove fake support for GIF on Windows and remove a printf. Created 7 years, 8 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
Index: tools/picture_utils.cpp
diff --git a/tools/picture_utils.cpp b/tools/picture_utils.cpp
index 7a5e156fb23173aa2e3a31bb3d46cd20451363f6..3dee665d11372213a4ff57b10f4fa0b3f4cdb190 100644
--- a/tools/picture_utils.cpp
+++ b/tools/picture_utils.cpp
@@ -15,15 +15,23 @@
namespace sk_tools {
void force_all_opaque(const SkBitmap& bitmap) {
SkASSERT(NULL == bitmap.getTexture());
- SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
- if (NULL != bitmap.getTexture() || SkBitmap::kARGB_8888_Config == bitmap.config()) {
+ if (NULL != bitmap.getTexture()) {
return;
}
- SkAutoLockPixels lock(bitmap);
- for (int y = 0; y < bitmap.height(); y++) {
- for (int x = 0; x < bitmap.width(); x++) {
- *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT);
+ SkBitmap bitmap8888;
+ const SkBitmap* bmPtr;
+ if (SkBitmap::kARGB_8888_Config == bitmap.config()) {
epoger 2013/04/19 21:35:16 Do non-8888 configs even allow for alpha channel v
scroggo 2013/04/19 22:12:01 I think kIndex8 does. And we can get kIndex8 from
+ bmPtr = &bitmap;
+ } else {
+ bitmap.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config);
+ bmPtr = &bitmap8888;
epoger 2013/04/19 21:35:16 In this case, are this method's modifications even
scroggo 2013/04/19 22:12:01 D'oh! No the modifications are not :(
scroggo 2013/04/22 22:10:15 Rather than modify this function further, so it wi
+ }
+
+ SkAutoLockPixels lock(*bmPtr);
+ for (int y = 0; y < bmPtr->height(); y++) {
+ for (int x = 0; x < bmPtr->width(); x++) {
+ *bmPtr->getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698