Chromium Code Reviews| 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); |
| } |
| } |
| } |