Revert of Rename kPMColor_SkColorType to kN32_SkColorType. (https://codereview.chromium.org/227433009/)

Reason for revert:
Chrome's side of define changes not easy to figure out quickly. Reverting this for DEPS roll for now.

Original issue's description:
> Rename kPMColor_SkColorType to kN32_SkColorType.
>
> The new name better represents what this flag means.
>
> BUG=skia:2384
>
> Committed: http://code.google.com/p/skia/source/detail?r=14117

R=reed@google.com, scroggo@google.com
TBR=reed@google.com, scroggo@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2384

Author: bensong@google.com

Review URL: https://codereview.chromium.org/234833003

git-svn-id: http://skia.googlecode.com/svn/trunk@14149 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-04-11 13:47:30 +00:00
parent 968757e17d
commit 96edc24598
77 changed files with 128 additions and 132 deletions

View File

@ -37,7 +37,7 @@ protected:
SkImageInfo info;
info.fWidth = kSurfaceWidth;
info.fHeight = kSurfaceHeight;
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kPremul_SkAlphaType;
const SkRect fullCanvasRect = SkRect::MakeWH(
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));

View File

@ -207,20 +207,20 @@ static const struct Config {
GLContextType contextType;
bool runByDefault;
} gConfigs[] = {
{ kN32_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backend, kNative, true},
{ kN32_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true},
{ kPMColor_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backend, kNative, true},
{ kPMColor_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true},
{ kRGB_565_SkColorType, "565", 0, SkBenchmark::kRaster_Backend, kNative, true},
#if SK_SUPPORT_GPU
{ kN32_SkColorType, "GPU", 0, SkBenchmark::kGPU_Backend, kNative, true},
{ kN32_SkColorType, "MSAA4", 4, SkBenchmark::kGPU_Backend, kNative, false},
{ kN32_SkColorType, "MSAA16", 16, SkBenchmark::kGPU_Backend, kNative, false},
{ kN32_SkColorType, "NVPRMSAA4", 4, SkBenchmark::kGPU_Backend, kNVPR, true},
{ kN32_SkColorType, "NVPRMSAA16", 16, SkBenchmark::kGPU_Backend, kNVPR, false},
{ kPMColor_SkColorType, "GPU", 0, SkBenchmark::kGPU_Backend, kNative, true},
{ kPMColor_SkColorType, "MSAA4", 4, SkBenchmark::kGPU_Backend, kNative, false},
{ kPMColor_SkColorType, "MSAA16", 16, SkBenchmark::kGPU_Backend, kNative, false},
{ kPMColor_SkColorType, "NVPRMSAA4", 4, SkBenchmark::kGPU_Backend, kNVPR, true},
{ kPMColor_SkColorType, "NVPRMSAA16", 16, SkBenchmark::kGPU_Backend, kNVPR, false},
#if SK_ANGLE
{ kN32_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true},
{ kPMColor_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true},
#endif // SK_ANGLE
{ kN32_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug},
{ kN32_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true},
{ kPMColor_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug},
{ kPMColor_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true},
#endif // SK_SUPPORT_GPU
};

View File

@ -19,7 +19,7 @@ SkImageWidget::SkImageWidget(SkDebugger *debugger)
SkImageInfo info;
info.fWidth = kImageWidgetWidth;
info.fHeight = kImageWidgetHeight;
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kPremul_SkAlphaType;
fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth);

View File

@ -88,7 +88,7 @@ static void kick_off_gms(const SkTDArray<GMRegistry::Factory>& gms,
for (int i = 0; i < gms.count(); i++) {
for (int j = 0; j < configs.count(); j++) {
START("565", CpuGMTask, kRGB_565_SkColorType);
START("8888", CpuGMTask, kN32_SkColorType);
START("8888", CpuGMTask, kPMColor_SkColorType);
START("gpu", GpuGMTask, native, 0);
START("msaa4", GpuGMTask, native, 4);
START("msaa16", GpuGMTask, native, 16);
@ -115,7 +115,7 @@ static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches,
for (int j = 0; j < configs.count(); j++) {
START("nonrendering", NonRenderingBenchTask);
START("565", CpuBenchTask, kRGB_565_SkColorType);
START("8888", CpuBenchTask, kN32_SkColorType);
START("8888", CpuBenchTask, kPMColor_SkColorType);
START("gpu", GpuBenchTask, native, 0);
START("msaa4", GpuBenchTask, native, 4);
START("msaa16", GpuBenchTask, native, 16);

View File

@ -63,7 +63,7 @@ static void draw_raster(SkBenchmark* bench, SkColorType colorType) {
}
void NonRenderingBenchTask::draw() {
draw_raster(fBench.get(), kN32_SkColorType);
draw_raster(fBench.get(), kPMColor_SkColorType);
}
void CpuBenchTask::draw() {
@ -73,7 +73,7 @@ void CpuBenchTask::draw() {
void GpuBenchTask::draw(GrContextFactory* grFactory) {
SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(),
fBench->getSize().y(),
kN32_SkColorType,
kPMColor_SkColorType,
kPremul_SkAlphaType);
SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount));

View File

@ -27,7 +27,7 @@ GpuGMTask::GpuGMTask(const char* config,
void GpuGMTask::draw(GrContextFactory* grFactory) {
SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()),
SkScalarCeilToInt(fGM->height()),
kN32_SkColorType,
kPMColor_SkColorType,
kPremul_SkAlphaType);
SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount));
SkCanvas* canvas = surface->getCanvas();

View File

@ -30,7 +30,7 @@
if (NULL != fWind) {
fWind->setVisibleP(true);
fWind->resize(self.frame.size.width, self.frame.size.height,
kN32_SkColorType);
kPMColor_SkColorType);
}
}

View File

@ -337,7 +337,7 @@ static FPSState gFPS;
fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager);
fWind->resize(self.frame.size.width, self.frame.size.height,
kN32_SkColorType);
kPMColor_SkColorType);
}
return self;
}

View File

@ -22,7 +22,7 @@ static const char* gColorTypeNames[] = {
static const SkColorType gColorTypes[] = {
kRGB_565_SkColorType,
kARGB_4444_SkColorType,
kN32_SkColorType,
kPMColor_SkColorType,
};
#define NUM_CONFIGS SK_ARRAY_COUNT(gColorTypes)

View File

@ -87,7 +87,7 @@ class FilterGM : public GM {
make_bm(&fBM8);
fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType);
fBM8.copyTo(&fBM16, kRGB_565_SkColorType);
fBM8.copyTo(&fBM32, kN32_SkColorType);
fBM8.copyTo(&fBM32, kPMColor_SkColorType);
}
public:
SkBitmap fBM8, fBM4444, fBM16, fBM32;

View File

@ -30,7 +30,7 @@ static void init_bitmap(SkColorType ct, SkBitmap* bitmap) {
static SkBitmap make_argb8888_gradient() {
SkBitmap bitmap;
init_bitmap(kN32_SkColorType, &bitmap);
init_bitmap(kPMColor_SkColorType, &bitmap);
uint8_t rowColor = 0;
for (int y = 0; y < SLIDE_SIZE; y++) {
uint32_t* dst = bitmap.getAddr32(0, y);
@ -64,7 +64,7 @@ static SkBitmap make_argb4444_gradient() {
static SkBitmap make_argb8888_stripes() {
SkBitmap bitmap;
init_bitmap(kN32_SkColorType, &bitmap);
init_bitmap(kPMColor_SkColorType, &bitmap);
uint8_t rowColor = 0;
for (int y = 0; y < SLIDE_SIZE; y++) {
uint32_t* dst = bitmap.getAddr32(0, y);

View File

@ -40,7 +40,7 @@ static bool setFont(SkPaint* paint, const char name[]) {
static CGContextRef makeCG(const SkImageInfo& info, const void* addr,
size_t rowBytes) {
if (kN32_SkColorType != info.colorType() || NULL == addr) {
if (kPMColor_SkColorType != info.colorType() || NULL == addr) {
return NULL;
}
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();

View File

@ -268,7 +268,7 @@ public:
static void force_all_opaque(const SkBitmap& bitmap) {
SkColorType colorType = bitmap.colorType();
switch (colorType) {
case kN32_SkColorType:
case kPMColor_SkColorType:
force_all_opaque_8888(bitmap);
break;
case kRGB_565_SkColorType:
@ -294,7 +294,7 @@ public:
// from this method, we should be able to get rid of the
// transformation to 8888 format also.
SkBitmap copy;
bitmap.copyTo(&copy, kN32_SkColorType);
bitmap.copyTo(&copy, kPMColor_SkColorType);
if (!SkImageEncoder::EncodeFile(path.c_str(), copy,
SkImageEncoder::kPNG_Type,
100)) {
@ -740,8 +740,8 @@ public:
return;
}
if ((kN32_SkColorType != expectedBitmap.colorType()) ||
(kN32_SkColorType != actualBitmap.colorType())) {
if ((kPMColor_SkColorType != expectedBitmap.colorType()) ||
(kPMColor_SkColorType != actualBitmap.colorType())) {
SkDebugf("---- %s: not computing max per-channel pixel mismatch because non-8888\n",
testName);
return;

View File

@ -50,7 +50,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
}
static const SkColorType gColorTypes[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
};
@ -166,7 +166,7 @@ static const int gHeight = 32;
static SkShader* make_bm(SkShader::TileMode tx, SkShader::TileMode ty) {
SkBitmap bm;
makebm(&bm, kN32_SkColorType, gWidth, gHeight);
makebm(&bm, kPMColor_SkColorType, gWidth, gHeight);
return SkShader::CreateBitmapShader(bm, tx, ty);
}

View File

@ -50,7 +50,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, SkPaint::FilterLevel filte
}
static const SkColorType gColorTypes[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
};
@ -177,7 +177,7 @@ static const int gHeight = 32;
static SkShader* make_bm(SkShader::TileMode tx, SkShader::TileMode ty) {
SkBitmap bm;
makebm(&bm, kN32_SkColorType, gWidth, gHeight);
makebm(&bm, kPMColor_SkColorType, gWidth, gHeight);
return SkShader::CreateBitmapShader(bm, tx, ty);
}

View File

@ -301,8 +301,9 @@
# Temporary until https:#googleplex-android-review.git.corp.google.com/#/c/442220/
# lands.
'SK_SUPPORT_LEGACY_GETTOTALCLIP',
# Still need to switch Android to the new name for N32.
'kNative_8888_SkColorType kN32_SkColorType',
# Use a better name for kPMColor_SkColorType until
# https://code.google.com/p/skia/issues/detail?id=2384 is fixed.
'kNative_8888_SkColorType kPMColor_SkColorType',
],
}],

View File

@ -16,7 +16,6 @@
'SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS=1',
'SK_SUPPORT_LEGACY_GETTOTALCLIP',
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
'SK_SUPPORT_LEGACY_N32_NAME',
],
},
}

View File

@ -80,16 +80,12 @@ enum SkColorType {
kLastEnum_SkColorType = kIndex_8_SkColorType,
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
kN32_SkColorType = kBGRA_8888_SkColorType,
kPMColor_SkColorType = kBGRA_8888_SkColorType
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
kN32_SkColorType = kRGBA_8888_SkColorType,
kPMColor_SkColorType = kRGBA_8888_SkColorType
#else
#error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
#endif
#ifdef SK_SUPPORT_LEGACY_N32_NAME
kPMColor_SkColorType = kN32_SkColorType
#endif
};
static int SkColorTypeBytesPerPixel(SkColorType ct) {
@ -140,7 +136,7 @@ struct SkImageInfo {
*/
static SkImageInfo MakeN32(int width, int height, SkAlphaType at) {
SkImageInfo info = {
width, height, kN32_SkColorType, at
width, height, kPMColor_SkColorType, at
};
return info;
}
@ -150,7 +146,7 @@ struct SkImageInfo {
*/
static SkImageInfo MakeN32Premul(int width, int height) {
SkImageInfo info = {
width, height, kN32_SkColorType, kPremul_SkAlphaType
width, height, kPMColor_SkColorType, kPremul_SkAlphaType
};
return info;
}

View File

@ -958,7 +958,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fSlideMenu = new SkOSMenu;
this->addMenu(fSlideMenu);
this->setColorType(kN32_SkColorType);
this->setColorType(kPMColor_SkColorType);
this->setVisibleP(true);
this->setClipToBounds(false);
@ -1449,7 +1449,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
SkBaseDevice* device = orig->getDevice();
SkBitmap bmp;
if (device->accessBitmap(false).copyTo(&bmp, kN32_SkColorType)) {
if (device->accessBitmap(false).copyTo(&bmp, kPMColor_SkColorType)) {
static int gSampleGrabCounter;
SkString name;
name.printf("sample_grab_%d.png", gSampleGrabCounter++);
@ -1552,7 +1552,7 @@ static SkColorType gColorTypeCycle[] = {
kUnknown_SkColorType, // none -> none
kUnknown_SkColorType, // a8 -> none
kARGB_4444_SkColorType, // 565 -> 4444
kN32_SkColorType, // 4444 -> 8888
kPMColor_SkColorType, // 4444 -> 8888
kRGB_565_SkColorType, // 8888 -> 565
kRGB_565_SkColorType, // 8888 -> 565
kUnknown_SkColorType, // index8 -> none

View File

@ -84,7 +84,7 @@ public:
DitherBitmapView() {
fResult = test_pathregion();
fBM8 = make_bitmap();
fBM8.copyTo(&fBM32, kN32_SkColorType);
fBM8.copyTo(&fBM32, kPMColor_SkColorType);
this->setBGColor(0xFFDDDDDD);
}

View File

@ -43,7 +43,7 @@ static void make_image(SkBitmap* bm, SkColorType ct, int configIndex) {
SkIntToScalar(width)/2, paint);
switch (ct) {
case kN32_SkColorType:
case kPMColor_SkColorType:
bm->swap(device);
break;
case kRGB_565_SkColorType: {
@ -81,7 +81,7 @@ static void make_image(SkBitmap* bm, SkColorType ct, int configIndex) {
// configs to build the original bitmap in. Can be at most these 3
static const SkColorType gColorTypes[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
kIndex_8_SkColorType, // opaque
kIndex_8_SkColorType // alpha

View File

@ -91,7 +91,7 @@ public:
make_bm(&fBM8);
fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType);
fBM8.copyTo(&fBM16, kRGB_565_SkColorType);
fBM8.copyTo(&fBM32, kN32_SkColorType);
fBM8.copyTo(&fBM32, kPMColor_SkColorType);
this->setBGColor(0xFFDDDDDD);
}

View File

@ -116,7 +116,7 @@ static bool valid_for_raster_canvas(const SkImageInfo& info) {
case kAlpha_8_SkColorType:
case kRGB_565_SkColorType:
return true;
case kN32_SkColorType:
case kPMColor_SkColorType:
return kPremul_SkAlphaType == info.alphaType() ||
kOpaque_SkAlphaType == info.alphaType();
default:

View File

@ -55,7 +55,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
}
static const SkColorType gColorTypes[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
};
static const int gWidth = 32;

View File

@ -346,7 +346,7 @@ static bool config_to_colorType(SkBitmap::Config config, SkColorType* ctOut) {
ct = kARGB_4444_SkColorType;
break;
case SkBitmap::kARGB_8888_Config:
ct = kN32_SkColorType;
ct = kPMColor_SkColorType;
break;
case SkBitmap::kNo_Config:
default:
@ -997,7 +997,7 @@ bool SkBitmap::canCopyTo(SkColorType dstColorType) const {
switch (dstColorType) {
case kAlpha_8_SkColorType:
case kRGB_565_SkColorType:
case kN32_SkColorType:
case kPMColor_SkColorType:
break;
case kIndex_8_SkColorType:
if (!sameConfigs) {
@ -1005,7 +1005,7 @@ bool SkBitmap::canCopyTo(SkColorType dstColorType) const {
}
break;
case kARGB_4444_SkColorType:
return sameConfigs || kN32_SkColorType == this->colorType();
return sameConfigs || kPMColor_SkColorType == this->colorType();
default:
return false;
}
@ -1116,7 +1116,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType,
}
}
} else if (kARGB_4444_SkColorType == dstColorType
&& kN32_SkColorType == src->colorType()) {
&& kPMColor_SkColorType == src->colorType()) {
SkASSERT(src->height() == tmpDst.height());
SkASSERT(src->width() == tmpDst.width());
for (int y = 0; y < src->height(); ++y) {

View File

@ -45,7 +45,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
case kRGB_565_SkColorType:
canonicalAlphaType = kOpaque_SkAlphaType;
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
break;
default:
return false;

View File

@ -124,7 +124,7 @@ bool SkBitmapProcState::setBitmapFilterProcs() {
}
// TODO: consider supporting other colortypes (e.g. 565, A8)
if (fBitmap->colorType() != kN32_SkColorType) {
if (fBitmap->colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -22,7 +22,7 @@ bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
case kAlpha_8_SkColorType:
case kRGB_565_SkColorType:
case kIndex_8_SkColorType:
case kN32_SkColorType:
case kPMColor_SkColorType:
// if (tx == ty && (kClamp_TileMode == tx || kRepeat_TileMode == tx))
return true;
default:
@ -130,7 +130,7 @@ bool SkBitmapProcShader::setContext(const SkBitmap& device,
flags |= (kHasSpan16_Flag | kIntrinsicly16_Flag);
break;
case kIndex_8_SkColorType:
case kN32_SkColorType:
case kPMColor_SkColorType:
if (bitmapIsOpaque) {
flags |= kHasSpan16_Flag;
}
@ -279,7 +279,7 @@ static bool canUseColorShader(const SkBitmap& bm, SkColor* color) {
}
switch (bm.colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
*color = SkUnPreMultiply::PMColorToColor(*bm.getAddr32(0, 0));
return true;
case kRGB_565_SkColorType:

View File

@ -282,7 +282,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
SkAutoLockPixels locker(source);
if (!source.readyToDraw() ||
source.colorType() != kN32_SkColorType) {
source.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -923,7 +923,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
blitter = SkBlitter_ChooseD565(device, *paint, allocator);
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
if (shader) {
blitter = allocator->createT<SkARGB32_Shader_Blitter>(device, *paint);
} else if (paint->getColor() == SK_ColorBLACK) {

View File

@ -67,7 +67,7 @@ SkBlitter* SkBlitter::ChooseSprite(const SkBitmap& device, const SkPaint& paint,
case kRGB_565_SkColorType:
blitter = SkSpriteBlitter::ChooseD16(source, paint, allocator);
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator);
break;
default:

View File

@ -2613,7 +2613,7 @@ static bool supported_for_raster_canvas(const SkImageInfo& info) {
switch (info.colorType()) {
case kAlpha_8_SkColorType:
case kRGB_565_SkColorType:
case kN32_SkColorType:
case kPMColor_SkColorType:
break;
default:
return false;

View File

@ -188,7 +188,7 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
*/
SkPMColor pmc = SkPreMultiplyColor(color);
switch (bitmap.colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
if (data) {
*data = pmc;
}
@ -221,7 +221,7 @@ static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect,
BitmapXferProc proc, uint32_t procData) {
int shiftPerPixel;
switch (bitmap.colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
shiftPerPixel = 2;
break;
case kRGB_565_SkColorType:
@ -515,7 +515,7 @@ PtProcRec::Proc PtProcRec::chooseProc(SkBlitter** blitterPtr) {
const SkBitmap* bm = blitter->justAnOpaqueColor(&value);
if (bm && kRGB_565_SkColorType == bm->colorType()) {
proc = bw_pt_rect_16_hair_proc;
} else if (bm && kN32_SkColorType == bm->colorType()) {
} else if (bm && kPMColor_SkColorType == bm->colorType()) {
proc = bw_pt_rect_32_hair_proc;
} else {
proc = bw_pt_rect_hair_proc;

View File

@ -277,7 +277,7 @@ bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
}
// can we relax this?
if (kN32_SkColorType != bitmap->colorType()) {
if (kPMColor_SkColorType != bitmap->colorType()) {
return false;
}

View File

@ -20,7 +20,7 @@
class Sprite_D32_S32 : public SkSpriteBlitter {
public:
Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) {
SkASSERT(src.colorType() == kN32_SkColorType);
SkASSERT(src.colorType() == kPMColor_SkColorType);
unsigned flags32 = 0;
if (255 != alpha) {
@ -289,7 +289,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source, const SkPain
blitter = allocator->createT<Sprite_D32_S4444>(source);
}
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
if (xfermode || filter) {
if (255 == alpha) {
// this can handle xfermode or filter, but not alpha

View File

@ -325,7 +325,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
unsigned alpha = paint.getAlpha();
switch (source.colorType()) {
case kN32_SkColorType: {
case kPMColor_SkColorType: {
blitter = allocator->createT<Sprite_D16_S32_BlitRowProc>(source);
break;
}

View File

@ -306,9 +306,9 @@ void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const {
bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
const Context& ctx, SkBitmap* dst,
SkIPoint* offset) const {
SkASSERT(src.colorType() == kN32_SkColorType);
SkASSERT(src.colorType() == kPMColor_SkColorType);
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -91,7 +91,7 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -149,7 +149,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -205,8 +205,8 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
(displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displOffset))) {
return false;
}
if ((displ.colorType() != kN32_SkColorType) ||
(color.colorType() != kN32_SkColorType)) {
if ((displ.colorType() != kPMColor_SkColorType) ||
(color.colorType() != kPMColor_SkColorType)) {
return false;
}
SkIRect bounds;

View File

@ -943,7 +943,7 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}
SkIRect bounds;
@ -1034,7 +1034,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -282,11 +282,11 @@ void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const {
bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src,
const Context&, SkBitmap* dst,
SkIPoint* offset) const {
SkASSERT(src.colorType() == kN32_SkColorType);
SkASSERT(src.colorType() == kPMColor_SkColorType);
SkASSERT(fSrcRect.width() < src.width());
SkASSERT(fSrcRect.height() < src.height());
if ((src.colorType() != kN32_SkColorType) ||
if ((src.colorType() != kPMColor_SkColorType) ||
(fSrcRect.width() >= src.width()) ||
(fSrcRect.height() >= src.height())) {
return false;

View File

@ -260,7 +260,7 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -149,7 +149,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p
return false;
}
if (src.colorType() != kN32_SkColorType) {
if (src.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -29,7 +29,7 @@ uint32_t SkTransparentShader::getFlags() {
if (fAlpha == 255)
flags |= kOpaqueAlpha_Flag;
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
if (fAlpha == 255 && fDevice->isOpaque())
flags |= kOpaqueAlpha_Flag;
break;
@ -43,7 +43,7 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
unsigned scale = SkAlpha255To256(fAlpha);
switch (fDevice->colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
if (scale == 256) {
SkPMColor* src = fDevice->getAddr32(x, y);
if (src != span) {

View File

@ -517,7 +517,7 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
info.fWidth = kCache32Count;
info.fHeight = 4; // for our 4 dither rows
info.fAlphaType = kPremul_SkAlphaType;
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
if (NULL == fCache32PixelRef) {
fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL);

View File

@ -229,7 +229,7 @@ SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo
if (kRGB_565_SkColorType == info.colorType()) {
info.fAlphaType = kOpaque_SkAlphaType; // force this setting
} else {
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
if (kOpaque_SkAlphaType != info.alphaType()) {
info.fAlphaType = kPremul_SkAlphaType; // force this setting
}

View File

@ -43,7 +43,7 @@ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
dstPI.fRowBytes = count * sizeof(SkPMColor);
SkSrcPixelInfo srcPI;
srcPI.fColorType = kN32_SkColorType;
srcPI.fColorType = kPMColor_SkColorType;
srcPI.fAlphaType = kPremul_SkAlphaType;
srcPI.fPixels = ctable->lockColors();
srcPI.fRowBytes = count * sizeof(SkPMColor);
@ -166,7 +166,7 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
return result;
}
} else {
origBitmap.copyTo(&tmpBitmap, kN32_SkColorType);
origBitmap.copyTo(&tmpBitmap, kPMColor_SkColorType);
// now bitmap points to our temp, which has been promoted to 32bits
bitmap = &tmpBitmap;
desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap->config());

View File

@ -90,7 +90,7 @@ SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
static bool raster_canvas_supports(const SkImageInfo& info) {
switch (info.fColorType) {
case kN32_SkColorType:
case kPMColor_SkColorType:
return kUnpremul_SkAlphaType != info.fAlphaType;
case kRGB_565_SkColorType:
return true;

View File

@ -20,7 +20,7 @@ SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType colorType) {
case kRGB_565_SkColorType:
return SkBitmap::kRGB_565_Config;
case kN32_SkColorType:
case kPMColor_SkColorType:
return SkBitmap::kARGB_8888_Config;
case kIndex_8_SkColorType:
@ -44,7 +44,7 @@ SkColorType SkBitmapConfigToColorType(SkBitmap::Config config) {
kIndex_8_SkColorType, // kIndex8_Config
kRGB_565_SkColorType, // kRGB_565_Config
kARGB_4444_SkColorType, // kARGB_4444_Config
kN32_SkColorType, // kARGB_8888_Config
kPMColor_SkColorType, // kARGB_8888_Config
};
SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
return gCT[config];

View File

@ -59,7 +59,7 @@ GrTexture* SkImage_Gpu::onGetTexture() {
}
bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
return fBitmap.copyTo(dst, kN32_SkColorType);
return fBitmap.copyTo(dst, kPMColor_SkColorType);
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -62,7 +62,7 @@ SkImage* SkSurface_Picture::onNewImageSnapshot() {
} else {
SkImageInfo info;
info.fWidth = info.fHeight = 0;
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
info.fAlphaType = kOpaque_SkAlphaType;
return SkImage::NewRasterCopy(info, NULL, 0);
}

View File

@ -47,7 +47,7 @@ bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
case kRGB_565_SkColorType:
shift = 1;
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
shift = 2;
break;
default:

View File

@ -242,7 +242,7 @@ SkImageGenerator* CreateDecodingImageGenerator(
if (kIndex_8_SkColorType == bitmap.colorType()) {
// We don't support kIndex8 because we don't support
// colortables in this workflow.
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
}
} else {
if (!bitmap.canCopyTo(opts.fRequestedColorType)) {

View File

@ -209,7 +209,7 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm,
// <Error>: CGImageDestinationFinalize image destination does not have enough images
// So instead we copy to 8888.
if (bm.colorType() == kARGB_4444_SkColorType) {
bm.copyTo(&bitmap8888, kN32_SkColorType);
bm.copyTo(&bitmap8888, kPMColor_SkColorType);
bmPtr = &bitmap8888;
}
type = kUTTypePNG;

View File

@ -306,10 +306,10 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
//Convert to 8888 if needed.
const SkBitmap* bitmap;
SkBitmap bitmapCopy;
if (kN32_SkColorType == bitmapOrig.colorType() && bitmapOrig.isOpaque()) {
if (kPMColor_SkColorType == bitmapOrig.colorType() && bitmapOrig.isOpaque()) {
bitmap = &bitmapOrig;
} else {
if (!bitmapOrig.copyTo(&bitmapCopy, kN32_SkColorType)) {
if (!bitmapOrig.copyTo(&bitmapCopy, kPMColor_SkColorType)) {
return false;
}
bitmap = &bitmapCopy;

View File

@ -57,7 +57,7 @@ static inline uint64_t first_8_bytes_as_uint64(const uint8_t *bytearray) {
// Hmm, that didn't work. Maybe if we create a new
// kARGB_8888_Config version of the bitmap it will work better?
SkBitmap copyBitmap;
if (!bitmap.copyTo(&copyBitmap, kN32_SkColorType)) {
if (!bitmap.copyTo(&copyBitmap, kPMColor_SkColorType)) {
return false;
}
return ComputeDigestInternal(copyBitmap, result);

View File

@ -223,7 +223,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
layerState->height = bitmap.height();
switch (bitmap.colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
layerState->raster.config = kARGB_8888_RasterConfig;
break;
case kRGB_565_SkColorType:
@ -281,7 +281,7 @@ static SkCanvas* create_canvas_from_canvas_layer(const SkCanvasLayerState& layer
SkBitmap bitmap;
SkColorType colorType =
layerState.raster.config == kARGB_8888_RasterConfig ? kN32_SkColorType :
layerState.raster.config == kARGB_8888_RasterConfig ? kPMColor_SkColorType :
layerState.raster.config == kRGB_565_RasterConfig ? kRGB_565_SkColorType :
kUnknown_SkColorType;

View File

@ -34,7 +34,7 @@ static bool getBitmapInfo(const SkBitmap& bm,
*upscaleTo32 = true;
}
// fall through
case kN32_SkColorType:
case kPMColor_SkColorType:
*bitsPerComponent = 8;
#if SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
*info = kCGBitmapByteOrder32Big;
@ -94,7 +94,7 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
copy = new SkBitmap;
// here we make a ceep copy of the pixels, since CG won't take our
// 565 directly
bm.copyTo(copy, kN32_SkColorType);
bm.copyTo(copy, kPMColor_SkColorType);
} else {
copy = new SkBitmap(bm);
}

View File

@ -53,7 +53,7 @@ SkWindow::SkWindow() : fFocusView(NULL) {
#ifdef SK_BUILD_FOR_WINCE
fColorType = kRGB_565_SkColorType;
#else
fColorType = kN32_SkColorType;
fColorType = kPMColor_SkColorType;
#endif
fMatrix.reset();

View File

@ -57,7 +57,7 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
size = [self convertSizeToBacking:self.frame.size];
#endif
fWind->resize((int) size.width, (int) size.height,
kN32_SkColorType);
kPMColor_SkColorType);
}
}

View File

@ -188,7 +188,7 @@ static const Pair gPairs[] = {
{ kIndex_8_SkColorType, "011101" },
{ kRGB_565_SkColorType, "010101" },
{ kARGB_4444_SkColorType, "010111" },
{ kN32_SkColorType, "010111" },
{ kPMColor_SkColorType, "010111" },
};
static const int W = 20;
@ -364,7 +364,7 @@ DEF_TEST(BitmapCopy, reporter) {
}
break;
case kN32_SkColorType:
case kPMColor_SkColorType:
if (safeSize != 0x8E1BC9BF040000LL) {
sizeFail = true;
}

View File

@ -22,9 +22,9 @@ DEF_TEST(GetColor, reporter) {
{ kAlpha_8_SkColorType, 0, 0 },
{ kRGB_565_SkColorType, 0xFF00FF00, 0xFF00FF00 },
{ kRGB_565_SkColorType, 0xFFFF00FF, 0xFFFF00FF },
{ kN32_SkColorType, 0xFFFFFFFF, 0xFFFFFFFF },
{ kN32_SkColorType, 0, 0 },
{ kN32_SkColorType, 0xFF224466, 0xFF224466 },
{ kPMColor_SkColorType, 0xFFFFFFFF, 0xFFFFFFFF },
{ kPMColor_SkColorType, 0, 0 },
{ kPMColor_SkColorType, 0xFF224466, 0xFF224466 },
};
// specify an area that doesn't touch (0,0) and may extend beyond the

View File

@ -25,7 +25,7 @@ static void test_bigwidth(skiatest::Reporter* reporter) {
// TODO: perhaps skia can relax this, and only require that rowBytes fit
// in a uint32_t (or larger), but for now this is the constraint.
info.fColorType = kN32_SkColorType;
info.fColorType = kPMColor_SkColorType;
REPORTER_ASSERT(reporter, !bm.setConfig(info));
}

View File

@ -63,7 +63,7 @@ static int proc_bad(const void*, int, uint32_t, uint32_t* bad) {
static Proc find_proc(const SkBitmap& bm, SkPMColor expect32, uint16_t expect16,
uint8_t expect8, uint32_t* expect) {
switch (bm.colorType()) {
case kN32_SkColorType:
case kPMColor_SkColorType:
*expect = expect32;
return proc_32;
case kARGB_4444_SkColorType:
@ -101,7 +101,7 @@ static void test_00_FF(skiatest::Reporter* reporter) {
static const int W = 256;
static const SkColorType gDstColorType[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
};
@ -192,7 +192,7 @@ static void test_diagonal(skiatest::Reporter* reporter) {
static const int H = W;
static const SkColorType gDstColorType[] = {
kN32_SkColorType,
kPMColor_SkColorType,
kRGB_565_SkColorType,
};

View File

@ -189,7 +189,7 @@ public:
}
info->fWidth = TestImageGenerator::Width();
info->fHeight = TestImageGenerator::Height();
info->fColorType = kN32_SkColorType;
info->fColorType = kPMColor_SkColorType;
info->fAlphaType = kOpaque_SkAlphaType;
return true;
}
@ -202,7 +202,7 @@ public:
REPORTER_ASSERT(fReporter, rowBytes >= minRowBytes);
if ((NULL == pixels)
|| (fType != kSucceedGetPixels_TestType)
|| (info.fColorType != kN32_SkColorType)) {
|| (info.fColorType != kPMColor_SkColorType)) {
return false;
}
char* bytePtr = static_cast<char*>(pixels);

View File

@ -26,7 +26,7 @@ static void test_complex_layers(skiatest::Reporter* reporter) {
SkIntToScalar((HEIGHT-(2*SPACER)) / 7));
const SkColorType colorTypes[] = {
kRGB_565_SkColorType, kN32_SkColorType
kRGB_565_SkColorType, kPMColor_SkColorType
};
const int configCount = sizeof(colorTypes) / sizeof(SkBitmap::Config);

View File

@ -25,7 +25,7 @@ public:
virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE {
info->fWidth = 100;
info->fHeight = 100;
info->fColorType = kN32_SkColorType;
info->fColorType = kPMColor_SkColorType;
info->fAlphaType = kPremul_SkAlphaType;
return true;
}

View File

@ -395,7 +395,7 @@ static inline const char* SkColorType_to_string(SkColorType colorType) {
case kAlpha_8_SkColorType: return "Alpha_8";
case kRGB_565_SkColorType: return "RGB_565";
case kARGB_4444_SkColorType: return "ARGB_4444";
case kN32_SkColorType: return "N32";
case kPMColor_SkColorType: return "PMColor";
case kBackwards_SkColorType: return "Backwards";
case kIndex_8_SkColorType: return "Index_8";
default: return "ERROR";
@ -537,7 +537,7 @@ DEF_TEST(ImageDecoderOptions, reporter) {
kAlpha_8_SkColorType,
kRGB_565_SkColorType,
kARGB_4444_SkColorType, // Most decoders will fail on 4444.
kN32_SkColorType
kPMColor_SkColorType
// Note that indexed color is left out of the list. Lazy
// decoding doesn't do indexed color.
};

View File

@ -381,7 +381,7 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
SkIRect clippedRect = DEV_RECT;
if (clippedRect.intersect(srcRect)) {
REPORTER_ASSERT(reporter, success);
REPORTER_ASSERT(reporter, kN32_SkColorType == wkbmp.colorType());
REPORTER_ASSERT(reporter, kPMColor_SkColorType == wkbmp.colorType());
REPORTER_ASSERT(reporter, kPremul_SkAlphaType == wkbmp.alphaType());
checkRead(reporter, wkbmp, clippedRect.fLeft,
clippedRect.fTop, true, false);

View File

@ -233,7 +233,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
static bool setup_bitmap_for_canvas(SkBitmap* bitmap) {
SkImageInfo info = SkImageInfo::Make(
kBitmapSize, kBitmapSize, kN32_SkColorType, kPremul_SkAlphaType);
kBitmapSize, kBitmapSize, kPMColor_SkColorType, kPremul_SkAlphaType);
return bitmap->allocPixels(info);
}

View File

@ -151,7 +151,7 @@ static void test_imagepeek(skiatest::Reporter* reporter) {
if (success) {
REPORTER_ASSERT(reporter, 10 == info.fWidth);
REPORTER_ASSERT(reporter, 10 == info.fHeight);
REPORTER_ASSERT(reporter, kN32_SkColorType == info.fColorType);
REPORTER_ASSERT(reporter, kPMColor_SkColorType == info.fColorType);
REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.fAlphaType ||
kOpaque_SkAlphaType == info.fAlphaType);
REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes);

View File

@ -213,7 +213,7 @@ static bool checkWrite(skiatest::Reporter* reporter, SkCanvas* canvas, const SkB
if (canvasInfo.width() != DEV_W ||
canvasInfo.height() != DEV_H ||
canvasInfo.colorType() != kN32_SkColorType) {
canvasInfo.colorType() != kPMColor_SkColorType) {
return false;
}

View File

@ -85,7 +85,7 @@ static void force_all_opaque(const SkBitmap& bitmap) {
bool write_bitmap(const SkString& path, const SkBitmap& bitmap) {
SkBitmap copy;
bitmap.copyTo(&copy, kN32_SkColorType);
bitmap.copyTo(&copy, kPMColor_SkColorType);
force_all_opaque(copy);
return SkImageEncoder::EncodeFile(path.c_str(), copy,
SkImageEncoder::kPNG_Type, 100);

View File

@ -164,7 +164,7 @@ static bool write_bitmap(const char outDir[], const char src[],
return true;
}
if (bm.colorType() == kN32_SkColorType) {
if (bm.colorType() == kPMColor_SkColorType) {
// First attempt at encoding failed, and the bitmap was already 8888. Making
// a copy is not going to help.
return false;
@ -172,7 +172,7 @@ static bool write_bitmap(const char outDir[], const char src[],
// Encoding failed. Copy to 8888 and try again.
SkBitmap bm8888;
if (!bm.copyTo(&bm8888, kN32_SkColorType)) {
if (!bm.copyTo(&bm8888, kPMColor_SkColorType)) {
return false;
}
return SkImageEncoder::EncodeFile(filename.c_str(), bm8888, SkImageEncoder::kPNG_Type, 100);

View File

@ -122,7 +122,7 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
// compute the image diff and output it
SkBitmap copy;
diffData.fResult.poiAlphaMask.copyTo(&copy, kN32_SkColorType);
diffData.fResult.poiAlphaMask.copyTo(&copy, kPMColor_SkColorType);
SkImageEncoder::EncodeFile(newRecord->fDifferencePath.c_str(), copy,
SkImageEncoder::kPNG_Type, 100);

View File

@ -125,8 +125,8 @@ static void adobergb_to_cielab(float r, float g, float b, LAB* lab) {
/// Converts a 8888 bitmap to LAB color space and puts it into the output
static bool bitmap_to_cielab(const SkBitmap* bitmap, ImageLAB* outImageLAB) {
SkBitmap bm8888;
if (bitmap->colorType() != kN32_SkColorType) {
if (!bitmap->copyTo(&bm8888, kN32_SkColorType)) {
if (bitmap->colorType() != kPMColor_SkColorType) {
if (!bitmap->copyTo(&bm8888, kPMColor_SkColorType)) {
return false;
}
bitmap = &bm8888;