Index: src/core/SkBitmap.cpp |
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
index 11c7cbd69c289991ea25c8894a6b62037ec34a2c..502d7db9b40c235b0865881b8acbb73e494019c2 100644 |
--- a/src/core/SkBitmap.cpp |
+++ b/src/core/SkBitmap.cpp |
@@ -190,10 +190,14 @@ size_t SkBitmap::ComputeRowBytes(Config c, int width) { |
break; |
case kRGB_565_Config: |
case kARGB_4444_Config: |
- rowBytes = width << 1; |
+ // assign and then shift, so we don't overflow int |
+ rowBytes = width; |
+ rowBytes <<= 1; |
break; |
case kARGB_8888_Config: |
- rowBytes = width << 2; |
+ // assign and then shift, so we don't overflow int |
+ rowBytes = width; |
+ rowBytes <<= 2; |
break; |
default: |
SkDEBUGFAIL("unknown config"); |