aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 15:57:47 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 15:57:47 +0000
commitcba73780bbd12fd254229517aec04fcbf0b64b52 (patch)
treef987d9fd68f7287c02b26f6fd9d073308051cef3
parent00f8d6c75d22ce8f95f932c5b101354b196fa0df (diff)
replace config() with colorType()
BUG=skia: R=robertphillips@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/303543009 git-svn-id: http://skia.googlecode.com/svn/trunk@14959 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/gm_expectations.h2
-rw-r--r--include/core/SkBlitRow.h2
-rw-r--r--src/core/SkBitmap.cpp64
-rw-r--r--src/core/SkBitmapDevice.cpp2
-rw-r--r--src/core/SkBitmapProcState.cpp24
-rw-r--r--src/core/SkBitmapProcState_procs.h30
-rw-r--r--src/core/SkBlitMask.h8
-rw-r--r--src/core/SkBlitMask_D32.cpp25
-rw-r--r--src/core/SkBlitRow_D16.cpp6
-rw-r--r--src/core/SkBlitter_ARGB32.cpp2
-rw-r--r--src/core/SkBlitter_RGB16.cpp4
-rw-r--r--src/core/SkSpriteBlitter_RGB16.cpp2
-rw-r--r--src/opts/SkBlitMask_opts_arm.cpp10
-rw-r--r--src/opts/SkBlitMask_opts_none.cpp10
-rw-r--r--src/opts/opts_check_x86.cpp10
15 files changed, 109 insertions, 92 deletions
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h
index 8d986f0847..c69fafc130 100644
--- a/gm/gm_expectations.h
+++ b/gm/gm_expectations.h
@@ -158,7 +158,7 @@ namespace skiagm {
* than a single bitmap), returns NULL.
*/
const SkBitmap *asBitmap() const {
- return (SkBitmap::kNo_Config == fBitmap.config()) ? NULL : &fBitmap;
+ return (kUnknown_SkColorType == fBitmap.colorType()) ? NULL : &fBitmap;
}
#ifdef SK_BUILD_JSON_WRITER
diff --git a/include/core/SkBlitRow.h b/include/core/SkBlitRow.h
index 501134238f..9393589b82 100644
--- a/include/core/SkBlitRow.h
+++ b/include/core/SkBlitRow.h
@@ -36,7 +36,7 @@ public:
const SkPMColor* src,
int count, U8CPU alpha, int x, int y);
- static Proc Factory(unsigned flags, SkBitmap::Config);
+ static Proc Factory(unsigned flags, SkColorType);
///////////// D32 version
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 0bfcb6fbed..e5cc0d7fcd 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -646,29 +646,29 @@ SkColor SkBitmap::getColor(int x, int y) const {
SkASSERT((unsigned)x < (unsigned)this->width());
SkASSERT((unsigned)y < (unsigned)this->height());
- switch (this->config()) {
- case SkBitmap::kA8_Config: {
+ switch (this->colorType()) {
+ case kAlpha_8_SkColorType: {
uint8_t* addr = this->getAddr8(x, y);
return SkColorSetA(0, addr[0]);
}
- case SkBitmap::kIndex8_Config: {
+ case kIndex_8_SkColorType: {
SkPMColor c = this->getIndex8Color(x, y);
return SkUnPreMultiply::PMColorToColor(c);
}
- case SkBitmap::kRGB_565_Config: {
+ case kRGB_565_SkColorType: {
uint16_t* addr = this->getAddr16(x, y);
return SkPixel16ToColor(addr[0]);
}
- case SkBitmap::kARGB_4444_Config: {
+ case kARGB_4444_SkColorType: {
uint16_t* addr = this->getAddr16(x, y);
SkPMColor c = SkPixel4444ToPixel32(addr[0]);
return SkUnPreMultiply::PMColorToColor(c);
}
- case SkBitmap::kARGB_8888_Config: {
+ case kBGRA_8888_SkColorType:
+ case kRGBA_8888_SkColorType: {
uint32_t* addr = this->getAddr32(x, y);
return SkUnPreMultiply::PMColorToColor(addr[0]);
}
- case kNo_Config:
default:
SkASSERT(false);
return 0;
@@ -686,8 +686,8 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
const int height = bm.height();
const int width = bm.width();
- switch (bm.config()) {
- case SkBitmap::kA8_Config: {
+ switch (bm.colorType()) {
+ case kAlpha_8_SkColorType: {
unsigned a = 0xFF;
for (int y = 0; y < height; ++y) {
const uint8_t* row = bm.getAddr8(0, y);
@@ -700,7 +700,7 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
}
return true;
} break;
- case SkBitmap::kIndex8_Config: {
+ case kIndex_8_SkColorType: {
SkAutoLockColors alc(bm);
const SkPMColor* table = alc.colors();
if (!table) {
@@ -712,10 +712,10 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
}
return 0xFF == SkGetPackedA32(c);
} break;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
return true;
break;
- case SkBitmap::kARGB_4444_Config: {
+ case kARGB_4444_SkColorType: {
unsigned c = 0xFFFF;
for (int y = 0; y < height; ++y) {
const SkPMColor16* row = bm.getAddr16(0, y);
@@ -728,7 +728,8 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
}
return true;
} break;
- case SkBitmap::kARGB_8888_Config: {
+ case kBGRA_8888_SkColorType:
+ case kRGBA_8888_SkColorType: {
SkPMColor c = (SkPMColor)~0;
for (int y = 0; y < height; ++y) {
const SkPMColor* row = bm.getAddr32(0, y);
@@ -883,8 +884,8 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset);
if (pixelRef != NULL) {
SkBitmap dst;
- dst.setConfig(this->config(), subset.width(), subset.height(), 0,
- this->alphaType());
+ dst.setConfig(SkImageInfo::Make(subset.width(), subset.height(),
+ this->colorType(), this->alphaType()));
dst.setIsVolatile(this->isVolatile());
dst.setPixelRef(pixelRef)->unref();
SkDEBUGCODE(dst.validate());
@@ -899,8 +900,8 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height()));
SkBitmap dst;
- dst.setConfig(this->config(), r.width(), r.height(), this->rowBytes(),
- this->alphaType());
+ dst.setConfig(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this->alphaType()),
+ this->rowBytes());
dst.setIsVolatile(this->isVolatile());
if (fPixelRef) {
@@ -1129,10 +1130,10 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
SkASSERT(alpha != NULL);
SkASSERT(alphaRowBytes >= src.width());
- SkBitmap::Config config = src.config();
- int w = src.width();
- int h = src.height();
- size_t rb = src.rowBytes();
+ SkColorType colorType = src.colorType();
+ int w = src.width();
+ int h = src.height();
+ size_t rb = src.rowBytes();
SkAutoLockPixels alp(src);
if (!src.readyToDraw()) {
@@ -1144,14 +1145,14 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
return false;
}
- if (SkBitmap::kA8_Config == config && !src.isOpaque()) {
+ if (kAlpha_8_SkColorType == colorType && !src.isOpaque()) {
const uint8_t* s = src.getAddr8(0, 0);
while (--h >= 0) {
memcpy(alpha, s, w);
s += rb;
alpha += alphaRowBytes;
}
- } else if (SkBitmap::kARGB_8888_Config == config && !src.isOpaque()) {
+ } else if (kN32_SkColorType == colorType && !src.isOpaque()) {
const SkPMColor* SK_RESTRICT s = src.getAddr32(0, 0);
while (--h >= 0) {
for (int x = 0; x < w; x++) {
@@ -1160,7 +1161,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
s = (const SkPMColor*)((const char*)s + rb);
alpha += alphaRowBytes;
}
- } else if (SkBitmap::kARGB_4444_Config == config && !src.isOpaque()) {
+ } else if (kARGB_4444_SkColorType == colorType && !src.isOpaque()) {
const SkPMColor16* SK_RESTRICT s = src.getAddr16(0, 0);
while (--h >= 0) {
for (int x = 0; x < w; x++) {
@@ -1169,7 +1170,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
s = (const SkPMColor16*)((const char*)s + rb);
alpha += alphaRowBytes;
}
- } else if (SkBitmap::kIndex8_Config == config && !src.isOpaque()) {
+ } else if (kIndex_8_SkColorType == colorType && !src.isOpaque()) {
SkColorTable* ct = src.getColorTable();
if (ct) {
const SkPMColor* SK_RESTRICT table = ct->lockColors();
@@ -1217,8 +1218,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
dstM.fRowBytes = SkAlign4(dstM.fBounds.width());
} else {
NO_FILTER_CASE:
- tmpBitmap.setConfig(SkBitmap::kA8_Config, this->width(), this->height(),
- srcM.fRowBytes);
+ tmpBitmap.setConfig(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes);
if (!tmpBitmap.allocPixels(allocator, NULL)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
@@ -1241,8 +1241,8 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint,
}
SkAutoMaskFreeImage dstCleanup(dstM.fImage);
- tmpBitmap.setConfig(SkBitmap::kA8_Config, dstM.fBounds.width(),
- dstM.fBounds.height(), dstM.fRowBytes);
+ tmpBitmap.setConfig(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
+ dstM.fRowBytes);
if (!tmpBitmap.allocPixels(allocator, NULL)) {
// Allocation of pixels for alpha bitmap failed.
SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
@@ -1435,12 +1435,12 @@ void SkBitmap::validate() const {
#ifndef SK_IGNORE_TO_STRING
void SkBitmap::toString(SkString* str) const {
- static const char* gConfigNames[kConfigCount] = {
- "NONE", "A8", "INDEX8", "565", "4444", "8888"
+ static const char* gColorTypeNames[kLastEnum_SkColorType + 1] = {
+ "UNKNOWN", "A8", "565", "4444", "RGBA", "BGRA", "INDEX8",
};
str->appendf("bitmap: ((%d, %d) %s", this->width(), this->height(),
- gConfigNames[this->config()]);
+ gColorTypeNames[this->colorType()]);
str->append(" (");
if (this->isOpaque()) {
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 76553ef141..109943598a 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -461,7 +461,7 @@ bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
return false;
}
- if (SkBitmap::kARGB_8888_Config != fBitmap.config() ||
+ if (kN32_SkColorType != fBitmap.colorType() ||
paint.getRasterizer() ||
paint.getPathEffect() ||
paint.isFakeBoldText() ||
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 220eb56316..166b62c48c 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -147,7 +147,7 @@ bool SkBitmapProcState::possiblyScaleImage() {
if (SkPaint::kHigh_FilterLevel == fFilterLevel &&
fInvMatrix.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask) &&
- fOrigBitmap.config() == SkBitmap::kARGB_8888_Config) {
+ kN32_SkColorType == fOrigBitmap.colorType()) {
SkScalar invScaleX = fInvMatrix.getScaleX();
SkScalar invScaleY = fInvMatrix.getScaleY();
@@ -285,10 +285,10 @@ bool SkBitmapProcState::possiblyScaleImage() {
SkScalar invScaleFixup = level.fScale;
fInvMatrix.postScale(invScaleFixup, invScaleFixup);
- fScaledBitmap.setConfig(fOrigBitmap.config(),
- level.fWidth, level.fHeight,
- level.fRowBytes);
- fScaledBitmap.setPixels(level.fPixels);
+ SkImageInfo info = fOrigBitmap.info();
+ info.fWidth = level.fWidth;
+ info.fHeight = level.fHeight;
+ fScaledBitmap.installPixels(info, level.fPixels, level.fRowBytes);
fBitmap = &fScaledBitmap;
fFilterLevel = SkPaint::kLow_FilterLevel;
unlocker.release();
@@ -508,20 +508,20 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
index |= 4;
}
// bits 3,4,5 encoding the source bitmap format
- switch (fBitmap->config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (fBitmap->colorType()) {
+ case kN32_SkColorType:
index |= 0;
break;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
index |= 8;
break;
- case SkBitmap::kIndex8_Config:
+ case kIndex_8_SkColorType:
index |= 16;
break;
- case SkBitmap::kARGB_4444_Config:
+ case kARGB_4444_SkColorType:
index |= 24;
break;
- case SkBitmap::kA8_Config:
+ case kAlpha_8_SkColorType:
index |= 32;
fPaintPMColor = SkPreMultiplyColor(paint.getColor());
break;
@@ -886,7 +886,7 @@ bool SkBitmapProcState::setupForTranslate() {
SkBitmapProcState::ShaderProc32 SkBitmapProcState::chooseShaderProc32() {
- if (SkBitmap::kARGB_8888_Config != fBitmap->config()) {
+ if (kN32_SkColorType != fBitmap->colorType()) {
return NULL;
}
diff --git a/src/core/SkBitmapProcState_procs.h b/src/core/SkBitmapProcState_procs.h
index 68c79835a9..0d3b723e67 100644
--- a/src/core/SkBitmapProcState_procs.h
+++ b/src/core/SkBitmapProcState_procs.h
@@ -90,7 +90,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S32_opaque_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE SkPMColor
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kARGB_8888_Config); \
+#define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
SkASSERT(state.fAlphaScale == 256)
#define RETURNDST(src) src
#define SRC_TO_FILTER(src) src
@@ -102,7 +102,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S32_alpha_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE SkPMColor
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kARGB_8888_Config); \
+#define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
SkASSERT(state.fAlphaScale < 256)
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
#define RETURNDST(src) SkAlphaMulQ(src, alphaScale)
@@ -121,7 +121,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S16_opaque_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kRGB_565_Config); \
+#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale == 256)
#define RETURNDST(src) SkPixel16ToPixel32(src)
#define SRC_TO_FILTER(src) src
@@ -137,7 +137,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S16_alpha_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kRGB_565_Config); \
+#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale < 256)
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
#define RETURNDST(src) SkAlphaMulQ(SkPixel16ToPixel32(src), alphaScale)
@@ -152,7 +152,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(SI8_opaque_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kIndex8_Config); \
+#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale == 256)
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
#define RETURNDST(src) table[src]
@@ -166,7 +166,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(SI8_alpha_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kIndex8_Config); \
+#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale < 256)
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
@@ -183,7 +183,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S4444_opaque_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE SkPMColor16
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kARGB_4444_Config); \
+#define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale == 256)
#define RETURNDST(src) SkPixel4444ToPixel32(src)
#define SRC_TO_FILTER(src) src
@@ -199,7 +199,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S4444_alpha_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE SkPMColor16
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kARGB_4444_Config); \
+#define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fAlphaScale < 256)
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
#define RETURNDST(src) SkAlphaMulQ(SkPixel4444ToPixel32(src), alphaScale)
@@ -218,7 +218,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(SA8_alpha_D32 ## suffix)
#define DSTSIZE 32
#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kA8_Config);
+#define CHECKSTATE(state) SkASSERT(kAlpha_8_SkColorType == state.fBitmap->colorType());
#define PREAMBLE(state) const SkPMColor pmColor = state.fPaintPMColor;
#define RETURNDST(src) SkAlphaMulQ(pmColor, SkAlpha255To256(src))
#define SRC_TO_FILTER(src) src
@@ -243,7 +243,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S32_D16 ## suffix)
#define DSTSIZE 16
#define SRCTYPE SkPMColor
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kARGB_8888_Config); \
+#define CHECKSTATE(state) SkASSERT(4 == state.fBitmap->bytesPerPixel()); \
SkASSERT(state.fBitmap->isOpaque())
#define RETURNDST(src) SkPixel32ToPixel16(src)
#define SRC_TO_FILTER(src) src
@@ -261,7 +261,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(S16_D16 ## suffix)
#define DSTSIZE 16
#define SRCTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kRGB_565_Config)
+#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap->colorType())
#define RETURNDST(src) src
#define SRC_TO_FILTER(src) src
#include "SkBitmapProcState_sample.h"
@@ -278,7 +278,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(SI8_D16 ## suffix)
#define DSTSIZE 16
#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kIndex8_Config); \
+#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
SkASSERT(state.fBitmap->isOpaque())
#define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitmap->getColorTable()->lock16BitCache()
#define RETURNDST(src) table[src]
@@ -306,7 +306,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(Clamp_S16_D16 ## suffix)
#define SRCTYPE uint16_t
#define DSTTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kRGB_565_Config)
+#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap->colorType())
#define SRC_TO_FILTER(src) src
#include "SkBitmapProcState_shaderproc.h"
@@ -319,7 +319,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(Repeat_S16_D16 ## suffix)
#define SRCTYPE uint16_t
#define DSTTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kRGB_565_Config)
+#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fBitmap->colorType())
#define SRC_TO_FILTER(src) src
#include "SkBitmapProcState_shaderproc.h"
@@ -334,7 +334,7 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix)
#define SRCTYPE uint8_t
#define DSTTYPE uint32_t
-#define CHECKSTATE(state) SkASSERT(state.fBitmap->config() == SkBitmap::kIndex8_Config)
+#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType())
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
#define SRC_TO_FILTER(src) table[src]
#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
diff --git a/src/core/SkBlitMask.h b/src/core/SkBlitMask.h
index ea1da257b7..32db43c3d8 100644
--- a/src/core/SkBlitMask.h
+++ b/src/core/SkBlitMask.h
@@ -51,13 +51,13 @@ public:
* Public entry-point to return a blitmask ColorProc.
* May return NULL if config or format are not supported.
*/
- static ColorProc ColorFactory(SkBitmap::Config, SkMask::Format, SkColor);
+ static ColorProc ColorFactory(SkColorType, SkMask::Format, SkColor);
/**
* Return either platform specific optimized blitmask ColorProc,
* or NULL if no optimized routine is available.
*/
- static ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor);
+ static ColorProc PlatformColorProcs(SkColorType, SkMask::Format, SkColor);
/**
* Public entry-point to return a blitcolor BlitLCD16RowProc.
@@ -78,13 +78,13 @@ public:
* Public entry-point to return a blitmask RowProc.
* May return NULL if config or format are not supported.
*/
- static RowProc RowFactory(SkBitmap::Config, SkMask::Format, RowFlags);
+ static RowProc RowFactory(SkColorType, SkMask::Format, RowFlags);
/**
* Return either platform specific optimized blitmask RowProc,
* or NULL if no optimized routine is available.
*/
- static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format, RowFlags);
+ static RowProc PlatformRowProcs(SkColorType, SkMask::Format, RowFlags);
};
#endif
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index 008386caa5..ef4d84bfcf 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "SkBlitMask.h"
#include "SkColor.h"
#include "SkColorPriv.h"
@@ -230,16 +237,16 @@ static SkBlitMask::ColorProc D32_LCD32_Factory(SkColor color) {
return (0xFF == SkColorGetA(color)) ? D32_LCD32_Opaque : D32_LCD32_Blend;
}
-SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkBitmap::Config config,
+SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkColorType ct,
SkMask::Format format,
SkColor color) {
- ColorProc proc = PlatformColorProcs(config, format, color);
+ ColorProc proc = PlatformColorProcs(ct, format, color);
if (proc) {
return proc;
}
- switch (config) {
- case SkBitmap::kARGB_8888_Config:
+ switch (ct) {
+ case kN32_SkColorType:
switch (format) {
case SkMask::kA8_Format:
return D32_A8_Factory(color);
@@ -259,7 +266,7 @@ SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkBitmap::Config config,
bool SkBlitMask::BlitColor(const SkBitmap& device, const SkMask& mask,
const SkIRect& clip, SkColor color) {
- ColorProc proc = ColorFactory(device.config(), mask.fFormat, color);
+ ColorProc proc = ColorFactory(device.colorType(), mask.fFormat, color);
if (proc) {
int x = clip.fLeft;
int y = clip.fTop;
@@ -548,11 +555,11 @@ static void LCD32_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
}
}
-SkBlitMask::RowProc SkBlitMask::RowFactory(SkBitmap::Config config,
+SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct,
SkMask::Format format,
RowFlags flags) {
// make this opt-in until chrome can rebaseline
- RowProc proc = PlatformRowProcs(config, format, flags);
+ RowProc proc = PlatformRowProcs(ct, format, flags);
if (proc) {
return proc;
}
@@ -567,8 +574,8 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkBitmap::Config config,
};
int index;
- switch (config) {
- case SkBitmap::kARGB_8888_Config:
+ switch (ct) {
+ case kN32_SkColorType:
switch (format) {
case SkMask::kBW_Format: index = 0; break;
case SkMask::kA8_Format: index = 2; break;
diff --git a/src/core/SkBlitRow_D16.cpp b/src/core/SkBlitRow_D16.cpp
index e244723986..1b2be06d12 100644
--- a/src/core/SkBlitRow_D16.cpp
+++ b/src/core/SkBlitRow_D16.cpp
@@ -224,15 +224,15 @@ static const SkBlitRow::Proc gDefault_565_Procs[] = {
S32A_D565_Blend_Dither
};
-SkBlitRow::Proc SkBlitRow::Factory(unsigned flags, SkBitmap::Config config) {
+SkBlitRow::Proc SkBlitRow::Factory(unsigned flags, SkColorType ct) {
SkASSERT(flags < SK_ARRAY_COUNT(gDefault_565_Procs));
// just so we don't crash
flags &= kFlags16_Mask;
SkBlitRow::Proc proc = NULL;
- switch (config) {
- case SkBitmap::kRGB_565_Config:
+ switch (ct) {
+ case kRGB_565_SkColorType:
proc = PlatformProcs565(flags);
if (NULL == proc) {
proc = gDefault_565_Procs[flags];
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index 118a1d12f3..f86bc47074 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -500,7 +500,7 @@ void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip)
if (shaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) {
flags |= SkBlitMask::kSrcIsOpaque_RowFlag;
}
- proc = SkBlitMask::RowFactory(SkBitmap::kARGB_8888_Config, mask.fFormat,
+ proc = SkBlitMask::RowFactory(kN32_SkColorType, mask.fFormat,
(SkBlitMask::RowFlags)flags);
if (NULL == proc) {
this->INHERITED::blitMask(mask, clip);
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index e22aac4eda..4503a2ae79 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -826,10 +826,10 @@ SkRGB16_Shader_Blitter::SkRGB16_Shader_Blitter(const SkBitmap& device,
flags |= SkBlitRow::kDither_Flag;
}
// used when we know our global alpha is 0xFF
- fOpaqueProc = SkBlitRow::Factory(flags, SkBitmap::kRGB_565_Config);
+ fOpaqueProc = SkBlitRow::Factory(flags, kRGB_565_SkColorType);
// used when we know our global alpha is < 0xFF
fAlphaProc = SkBlitRow::Factory(flags | SkBlitRow::kGlobalAlpha_Flag,
- SkBitmap::kRGB_565_Config);
+ kRGB_565_SkColorType);
}
SkRGB16_Shader_Blitter::~SkRGB16_Shader_Blitter() {
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 3f712bb3ec..1ba3ee22fc 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -278,7 +278,7 @@ public:
if (paint.isDither()) {
flags |= SkBlitRow::kDither_Flag;
}
- fProc = SkBlitRow::Factory(flags, SkBitmap::kRGB_565_Config);
+ fProc = SkBlitRow::Factory(flags, kRGB_565_SkColorType);
}
virtual void blitRect(int x, int y, int width, int height) {
diff --git a/src/opts/SkBlitMask_opts_arm.cpp b/src/opts/SkBlitMask_opts_arm.cpp
index 5cac6c8fc7..a8a92ccba1 100644
--- a/src/opts/SkBlitMask_opts_arm.cpp
+++ b/src/opts/SkBlitMask_opts_arm.cpp
@@ -1,3 +1,9 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "SkColor.h"
#include "SkColorPriv.h"
@@ -5,7 +11,7 @@
#include "SkUtilsArm.h"
#include "SkBlitMask_opts_arm_neon.h"
-SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
+SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkColorType dstCT,
SkMask::Format maskFormat,
SkColor color) {
#if SK_ARM_NEON_IS_NONE
@@ -39,7 +45,7 @@ SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
}
}
-SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig,
+SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType dstCT,
SkMask::Format maskFormat,
RowFlags flags) {
return NULL;
diff --git a/src/opts/SkBlitMask_opts_none.cpp b/src/opts/SkBlitMask_opts_none.cpp
index 0ad0919387..90f89a7129 100644
--- a/src/opts/SkBlitMask_opts_none.cpp
+++ b/src/opts/SkBlitMask_opts_none.cpp
@@ -1,7 +1,13 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "SkBlitMask.h"
-SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
+SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkColorType dstCT,
SkMask::Format maskFormat,
SkColor color) {
return NULL;
@@ -11,7 +17,7 @@ SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
return NULL;
}
-SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig,
+SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType dstCT,
SkMask::Format maskFormat,
RowFlags flags) {
return NULL;
diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp
index ecce7ca1ec..6af47729cd 100644
--- a/src/opts/opts_check_x86.cpp
+++ b/src/opts/opts_check_x86.cpp
@@ -244,7 +244,7 @@ SkBlitRow::ColorRectProc PlatformColorRectProcFactory() {
////////////////////////////////////////////////////////////////////////////////
-SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
+SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkColorType dstCT,
SkMask::Format maskFormat,
SkColor color) {
if (SkMask::kA8_Format != maskFormat) {
@@ -253,8 +253,8 @@ SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
ColorProc proc = NULL;
if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
- switch (dstConfig) {
- case SkBitmap::kARGB_8888_Config:
+ switch (dstCT) {
+ case kN32_SkColorType:
// The SSE2 version is not (yet) faster for black, so we check
// for that.
if (SK_ColorBLACK != color) {
@@ -281,9 +281,7 @@ SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
}
-SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig,
- SkMask::Format maskFormat,
- RowFlags flags) {
+SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkColorType, SkMask::Format, RowFlags) {
return NULL;
}