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

Unified Diff: src/core/SkBitmap_scroll.cpp

Issue 173893002: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/core/SkBitmapScaler.cpp ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/core/SkBitmapScaler.cpp ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698