Index: src/core/SkBitmap_scroll.cpp |
diff --git a/src/core/SkBitmap_scroll.cpp b/src/core/SkBitmap_scroll.cpp |
index e9c886f4a0e7c43d5a1762fdf6f514660adf87e1..00a72aa1cab983f5a9ad089bbca7298c2da2c445 100644 |
--- a/src/core/SkBitmap_scroll.cpp |
+++ b/src/core/SkBitmap_scroll.cpp |
@@ -11,7 +11,7 @@ |
bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, |
SkRegion* inval) const |
{ |
- if (this->isImmutable()) { |
+ if (this->isImmutable() || kUnknown_SkColorType == this->colorType()) { |
return false; |
} |
@@ -23,25 +23,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, |
tmp.scrollRect(NULL, dx, dy, inval); |
} |
- int shift; |
- |
- switch (this->config()) { |
- case kIndex8_Config: |
- case kA8_Config: |
- shift = 0; |
- break; |
- case kARGB_4444_Config: |
- case kRGB_565_Config: |
- shift = 1; |
- break; |
- case kARGB_8888_Config: |
- shift = 2; |
- break; |
- default: |
- // can't scroll this config |
- return false; |
- } |
- |
+ int shift = this->bytesPerPixel() >> 1; |
int width = this->width(); |
int height = this->height(); |