| 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()) {
|
| + bmPtr = &bitmap;
|
| + } else {
|
| + bitmap.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config);
|
| + bmPtr = &bitmap8888;
|
| + }
|
| +
|
| + 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);
|
| }
|
| }
|
| }
|
|
|