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

Unified Diff: src/effects/SkTransparentShader.cpp

Issue 168843002: use SkColorType instead of SkBitmap::Config in views/effects (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/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTransparentShader.cpp
diff --git a/src/effects/SkTransparentShader.cpp b/src/effects/SkTransparentShader.cpp
index 1d7e80877e169f41612121cd1306c498427fd2b7..9de4a0cc23423d14ec451d7f5237b554341aad90 100644
--- a/src/effects/SkTransparentShader.cpp
+++ b/src/effects/SkTransparentShader.cpp
@@ -23,13 +23,13 @@ bool SkTransparentShader::setContext(const SkBitmap& device,
uint32_t SkTransparentShader::getFlags() {
uint32_t flags = this->INHERITED::getFlags();
- switch (fDevice->config()) {
- case SkBitmap::kRGB_565_Config:
+ switch (fDevice->colorType()) {
+ case kRGB_565_SkColorType:
flags |= kHasSpan16_Flag;
if (fAlpha == 255)
flags |= kOpaqueAlpha_Flag;
break;
- case SkBitmap::kARGB_8888_Config:
+ case kPMColor_SkColorType:
if (fAlpha == 255 && fDevice->isOpaque())
flags |= kOpaqueAlpha_Flag;
break;
@@ -42,8 +42,8 @@ uint32_t SkTransparentShader::getFlags() {
void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
unsigned scale = SkAlpha255To256(fAlpha);
- switch (fDevice->config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (fDevice->colorType()) {
+ case kPMColor_SkColorType:
if (scale == 256) {
SkPMColor* src = fDevice->getAddr32(x, y);
if (src != span) {
@@ -56,7 +56,7 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
}
}
break;
- case SkBitmap::kRGB_565_Config: {
+ case kRGB_565_SkColorType: {
const uint16_t* src = fDevice->getAddr16(x, y);
if (scale == 256) {
for (int i = count - 1; i >= 0; --i) {
@@ -78,10 +78,7 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
}
break;
}
- case SkBitmap::kIndex8_Config:
- SkDEBUGFAIL("index8 not supported as a destination device");
- break;
- case SkBitmap::kA8_Config: {
+ case kAlpha_8_SkColorType: {
const uint8_t* src = fDevice->getAddr8(x, y);
if (scale == 256) {
for (int i = count - 1; i >= 0; --i) {
@@ -94,13 +91,14 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
}
break;
}
- default: // to avoid warnings
+ default:
+ SkDEBUGFAIL("colorType not supported as a destination device");
break;
}
}
void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count) {
- SkASSERT(fDevice->config() == SkBitmap::kRGB_565_Config);
+ SkASSERT(fDevice->colorType() == kRGB_565_SkColorType);
uint16_t* src = fDevice->getAddr16(x, y);
if (src != span) {
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698