Revert of Revert of Rename kPMColor_SkColorType to kN32_SkColorType. (https://codereview.chromium.org/234243002/)
Reason for revert: fixes on the chrome side are landing (brettw), keep fingers crossed. Original issue's description: > Revert of Rename kPMColor_SkColorType to kN32_SkColorType. (https://codereview.chromium.org/227433009/) > > Reason for revert: > breaking the Chrome deps roll. > http://build.chromium.org/p/chromium.linux/builders/Linux%20GN%20%28dbg%29/builds/839/steps/compile/logs/stdio > > 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 > > TBR=reed@google.com,scroggo@google.com > NOTREECHECKS=true > NOTRY=true > BUG=skia:2384 > > Committed: http://code.google.com/p/skia/source/detail?r=14144 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/233813004 git-svn-id: http://skia.googlecode.com/svn/trunk@14145 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
757ebd20ef
commit
d923288e50
@ -37,7 +37,7 @@ protected:
|
||||
SkImageInfo info;
|
||||
info.fWidth = kSurfaceWidth;
|
||||
info.fHeight = kSurfaceHeight;
|
||||
info.fColorType = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
info.fAlphaType = kPremul_SkAlphaType;
|
||||
const SkRect fullCanvasRect = SkRect::MakeWH(
|
||||
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));
|
||||
|
@ -207,20 +207,20 @@ static const struct Config {
|
||||
GLContextType contextType;
|
||||
bool runByDefault;
|
||||
} gConfigs[] = {
|
||||
{ kPMColor_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backend, kNative, true},
|
||||
{ kPMColor_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true},
|
||||
{ kN32_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backend, kNative, true},
|
||||
{ kN32_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true},
|
||||
{ kRGB_565_SkColorType, "565", 0, SkBenchmark::kRaster_Backend, kNative, true},
|
||||
#if SK_SUPPORT_GPU
|
||||
{ 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},
|
||||
{ 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},
|
||||
#if SK_ANGLE
|
||||
{ kPMColor_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true},
|
||||
{ kN32_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true},
|
||||
#endif // SK_ANGLE
|
||||
{ kPMColor_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug},
|
||||
{ kPMColor_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true},
|
||||
{ kN32_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug},
|
||||
{ kN32_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true},
|
||||
#endif // SK_SUPPORT_GPU
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ SkImageWidget::SkImageWidget(SkDebugger *debugger)
|
||||
SkImageInfo info;
|
||||
info.fWidth = kImageWidgetWidth;
|
||||
info.fHeight = kImageWidgetHeight;
|
||||
info.fColorType = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
info.fAlphaType = kPremul_SkAlphaType;
|
||||
|
||||
fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth);
|
||||
|
@ -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, kPMColor_SkColorType);
|
||||
START("8888", CpuGMTask, kN32_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, kPMColor_SkColorType);
|
||||
START("8888", CpuBenchTask, kN32_SkColorType);
|
||||
START("gpu", GpuBenchTask, native, 0);
|
||||
START("msaa4", GpuBenchTask, native, 4);
|
||||
START("msaa16", GpuBenchTask, native, 16);
|
||||
|
@ -63,7 +63,7 @@ static void draw_raster(SkBenchmark* bench, SkColorType colorType) {
|
||||
}
|
||||
|
||||
void NonRenderingBenchTask::draw() {
|
||||
draw_raster(fBench.get(), kPMColor_SkColorType);
|
||||
draw_raster(fBench.get(), kN32_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(),
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kPremul_SkAlphaType);
|
||||
SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount));
|
||||
|
||||
|
@ -27,7 +27,7 @@ GpuGMTask::GpuGMTask(const char* config,
|
||||
void GpuGMTask::draw(GrContextFactory* grFactory) {
|
||||
SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()),
|
||||
SkScalarCeilToInt(fGM->height()),
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kPremul_SkAlphaType);
|
||||
SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, info, fSampleCount));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
|
@ -30,7 +30,7 @@
|
||||
if (NULL != fWind) {
|
||||
fWind->setVisibleP(true);
|
||||
fWind->resize(self.frame.size.width, self.frame.size.height,
|
||||
kPMColor_SkColorType);
|
||||
kN32_SkColorType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ static FPSState gFPS;
|
||||
fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager);
|
||||
|
||||
fWind->resize(self.frame.size.width, self.frame.size.height,
|
||||
kPMColor_SkColorType);
|
||||
kN32_SkColorType);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ static const char* gColorTypeNames[] = {
|
||||
static const SkColorType gColorTypes[] = {
|
||||
kRGB_565_SkColorType,
|
||||
kARGB_4444_SkColorType,
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
};
|
||||
|
||||
#define NUM_CONFIGS SK_ARRAY_COUNT(gColorTypes)
|
||||
|
@ -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, kPMColor_SkColorType);
|
||||
fBM8.copyTo(&fBM32, kN32_SkColorType);
|
||||
}
|
||||
public:
|
||||
SkBitmap fBM8, fBM4444, fBM16, fBM32;
|
||||
|
@ -30,7 +30,7 @@ static void init_bitmap(SkColorType ct, SkBitmap* bitmap) {
|
||||
|
||||
static SkBitmap make_argb8888_gradient() {
|
||||
SkBitmap bitmap;
|
||||
init_bitmap(kPMColor_SkColorType, &bitmap);
|
||||
init_bitmap(kN32_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(kPMColor_SkColorType, &bitmap);
|
||||
init_bitmap(kN32_SkColorType, &bitmap);
|
||||
uint8_t rowColor = 0;
|
||||
for (int y = 0; y < SLIDE_SIZE; y++) {
|
||||
uint32_t* dst = bitmap.getAddr32(0, y);
|
||||
|
@ -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 (kPMColor_SkColorType != info.colorType() || NULL == addr) {
|
||||
if (kN32_SkColorType != info.colorType() || NULL == addr) {
|
||||
return NULL;
|
||||
}
|
||||
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
|
||||
|
@ -268,7 +268,7 @@ public:
|
||||
static void force_all_opaque(const SkBitmap& bitmap) {
|
||||
SkColorType colorType = bitmap.colorType();
|
||||
switch (colorType) {
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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(©, kPMColor_SkColorType);
|
||||
bitmap.copyTo(©, kN32_SkColorType);
|
||||
if (!SkImageEncoder::EncodeFile(path.c_str(), copy,
|
||||
SkImageEncoder::kPNG_Type,
|
||||
100)) {
|
||||
@ -740,8 +740,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if ((kPMColor_SkColorType != expectedBitmap.colorType()) ||
|
||||
(kPMColor_SkColorType != actualBitmap.colorType())) {
|
||||
if ((kN32_SkColorType != expectedBitmap.colorType()) ||
|
||||
(kN32_SkColorType != actualBitmap.colorType())) {
|
||||
SkDebugf("---- %s: not computing max per-channel pixel mismatch because non-8888\n",
|
||||
testName);
|
||||
return;
|
||||
|
@ -50,7 +50,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
|
||||
}
|
||||
|
||||
static const SkColorType gColorTypes[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_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, kPMColor_SkColorType, gWidth, gHeight);
|
||||
makebm(&bm, kN32_SkColorType, gWidth, gHeight);
|
||||
return SkShader::CreateBitmapShader(bm, tx, ty);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, SkPaint::FilterLevel filte
|
||||
}
|
||||
|
||||
static const SkColorType gColorTypes[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_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, kPMColor_SkColorType, gWidth, gHeight);
|
||||
makebm(&bm, kN32_SkColorType, gWidth, gHeight);
|
||||
return SkShader::CreateBitmapShader(bm, tx, ty);
|
||||
}
|
||||
|
||||
|
@ -301,9 +301,8 @@
|
||||
# Temporary until https:#googleplex-android-review.git.corp.google.com/#/c/442220/
|
||||
# lands.
|
||||
'SK_SUPPORT_LEGACY_GETTOTALCLIP',
|
||||
# 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',
|
||||
# Still need to switch Android to the new name for N32.
|
||||
'kNative_8888_SkColorType kN32_SkColorType',
|
||||
],
|
||||
}],
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
'SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS=1',
|
||||
'SK_SUPPORT_LEGACY_GETTOTALCLIP',
|
||||
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
|
||||
'SK_SUPPORT_LEGACY_N32_NAME',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
@ -80,12 +80,16 @@ enum SkColorType {
|
||||
kLastEnum_SkColorType = kIndex_8_SkColorType,
|
||||
|
||||
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
|
||||
kPMColor_SkColorType = kBGRA_8888_SkColorType
|
||||
kN32_SkColorType = kBGRA_8888_SkColorType,
|
||||
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
|
||||
kPMColor_SkColorType = kRGBA_8888_SkColorType
|
||||
kN32_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) {
|
||||
@ -136,7 +140,7 @@ struct SkImageInfo {
|
||||
*/
|
||||
static SkImageInfo MakeN32(int width, int height, SkAlphaType at) {
|
||||
SkImageInfo info = {
|
||||
width, height, kPMColor_SkColorType, at
|
||||
width, height, kN32_SkColorType, at
|
||||
};
|
||||
return info;
|
||||
}
|
||||
@ -146,7 +150,7 @@ struct SkImageInfo {
|
||||
*/
|
||||
static SkImageInfo MakeN32Premul(int width, int height) {
|
||||
SkImageInfo info = {
|
||||
width, height, kPMColor_SkColorType, kPremul_SkAlphaType
|
||||
width, height, kN32_SkColorType, kPremul_SkAlphaType
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
|
||||
fSlideMenu = new SkOSMenu;
|
||||
this->addMenu(fSlideMenu);
|
||||
|
||||
this->setColorType(kPMColor_SkColorType);
|
||||
this->setColorType(kN32_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, kPMColor_SkColorType)) {
|
||||
if (device->accessBitmap(false).copyTo(&bmp, kN32_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
|
||||
kPMColor_SkColorType, // 4444 -> 8888
|
||||
kN32_SkColorType, // 4444 -> 8888
|
||||
kRGB_565_SkColorType, // 8888 -> 565
|
||||
kRGB_565_SkColorType, // 8888 -> 565
|
||||
kUnknown_SkColorType, // index8 -> none
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
DitherBitmapView() {
|
||||
fResult = test_pathregion();
|
||||
fBM8 = make_bitmap();
|
||||
fBM8.copyTo(&fBM32, kPMColor_SkColorType);
|
||||
fBM8.copyTo(&fBM32, kN32_SkColorType);
|
||||
|
||||
this->setBGColor(0xFFDDDDDD);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ static void make_image(SkBitmap* bm, SkColorType ct, int configIndex) {
|
||||
SkIntToScalar(width)/2, paint);
|
||||
|
||||
switch (ct) {
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kRGB_565_SkColorType,
|
||||
kIndex_8_SkColorType, // opaque
|
||||
kIndex_8_SkColorType // alpha
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
make_bm(&fBM8);
|
||||
fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType);
|
||||
fBM8.copyTo(&fBM16, kRGB_565_SkColorType);
|
||||
fBM8.copyTo(&fBM32, kPMColor_SkColorType);
|
||||
fBM8.copyTo(&fBM32, kN32_SkColorType);
|
||||
|
||||
this->setBGColor(0xFFDDDDDD);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ static bool valid_for_raster_canvas(const SkImageInfo& info) {
|
||||
case kAlpha_8_SkColorType:
|
||||
case kRGB_565_SkColorType:
|
||||
return true;
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
return kPremul_SkAlphaType == info.alphaType() ||
|
||||
kOpaque_SkAlphaType == info.alphaType();
|
||||
default:
|
||||
|
@ -55,7 +55,7 @@ static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
|
||||
}
|
||||
|
||||
static const SkColorType gColorTypes[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kRGB_565_SkColorType,
|
||||
};
|
||||
static const int gWidth = 32;
|
||||
|
@ -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 = kPMColor_SkColorType;
|
||||
ct = kN32_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 kPMColor_SkColorType:
|
||||
case kN32_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 || kPMColor_SkColorType == this->colorType();
|
||||
return sameConfigs || kN32_SkColorType == this->colorType();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -1116,7 +1116,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType,
|
||||
}
|
||||
}
|
||||
} else if (kARGB_4444_SkColorType == dstColorType
|
||||
&& kPMColor_SkColorType == src->colorType()) {
|
||||
&& kN32_SkColorType == src->colorType()) {
|
||||
SkASSERT(src->height() == tmpDst.height());
|
||||
SkASSERT(src->width() == tmpDst.width());
|
||||
for (int y = 0; y < src->height(); ++y) {
|
||||
|
@ -45,7 +45,7 @@ static bool valid_for_bitmap_device(const SkImageInfo& info,
|
||||
case kRGB_565_SkColorType:
|
||||
canonicalAlphaType = kOpaque_SkAlphaType;
|
||||
break;
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -124,7 +124,7 @@ bool SkBitmapProcState::setBitmapFilterProcs() {
|
||||
}
|
||||
|
||||
// TODO: consider supporting other colortypes (e.g. 565, A8)
|
||||
if (fBitmap->colorType() != kPMColor_SkColorType) {
|
||||
if (fBitmap->colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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 kPMColor_SkColorType:
|
||||
case kN32_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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
if (bitmapIsOpaque) {
|
||||
flags |= kHasSpan16_Flag;
|
||||
}
|
||||
@ -279,7 +279,7 @@ static bool canUseColorShader(const SkBitmap& bm, SkColor* color) {
|
||||
}
|
||||
|
||||
switch (bm.colorType()) {
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
*color = SkUnPreMultiply::PMColorToColor(*bm.getAddr32(0, 0));
|
||||
return true;
|
||||
case kRGB_565_SkColorType:
|
||||
|
@ -282,7 +282,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
|
||||
|
||||
SkAutoLockPixels locker(source);
|
||||
if (!source.readyToDraw() ||
|
||||
source.colorType() != kPMColor_SkColorType) {
|
||||
source.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -923,7 +923,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
|
||||
blitter = SkBlitter_ChooseD565(device, *paint, allocator);
|
||||
break;
|
||||
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
if (shader) {
|
||||
blitter = allocator->createT<SkARGB32_Shader_Blitter>(device, *paint);
|
||||
} else if (paint->getColor() == SK_ColorBLACK) {
|
||||
|
@ -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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
blitter = SkSpriteBlitter::ChooseD32(source, paint, allocator);
|
||||
break;
|
||||
default:
|
||||
|
@ -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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -188,7 +188,7 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
|
||||
*/
|
||||
SkPMColor pmc = SkPreMultiplyColor(color);
|
||||
switch (bitmap.colorType()) {
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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 kPMColor_SkColorType:
|
||||
case kN32_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 && kPMColor_SkColorType == bm->colorType()) {
|
||||
} else if (bm && kN32_SkColorType == bm->colorType()) {
|
||||
proc = bw_pt_rect_32_hair_proc;
|
||||
} else {
|
||||
proc = bw_pt_rect_hair_proc;
|
||||
|
@ -277,7 +277,7 @@ bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
|
||||
}
|
||||
|
||||
// can we relax this?
|
||||
if (kPMColor_SkColorType != bitmap->colorType()) {
|
||||
if (kN32_SkColorType != bitmap->colorType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
class Sprite_D32_S32 : public SkSpriteBlitter {
|
||||
public:
|
||||
Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) {
|
||||
SkASSERT(src.colorType() == kPMColor_SkColorType);
|
||||
SkASSERT(src.colorType() == kN32_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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
if (xfermode || filter) {
|
||||
if (255 == alpha) {
|
||||
// this can handle xfermode or filter, but not alpha
|
||||
|
@ -325,7 +325,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
|
||||
unsigned alpha = paint.getAlpha();
|
||||
|
||||
switch (source.colorType()) {
|
||||
case kPMColor_SkColorType: {
|
||||
case kN32_SkColorType: {
|
||||
blitter = allocator->createT<Sprite_D16_S32_BlitRowProc>(source);
|
||||
break;
|
||||
}
|
||||
|
@ -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() == kPMColor_SkColorType);
|
||||
SkASSERT(src.colorType() == kN32_SkColorType);
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
|
||||
(displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displOffset))) {
|
||||
return false;
|
||||
}
|
||||
if ((displ.colorType() != kPMColor_SkColorType) ||
|
||||
(color.colorType() != kPMColor_SkColorType)) {
|
||||
if ((displ.colorType() != kN32_SkColorType) ||
|
||||
(color.colorType() != kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
SkIRect bounds;
|
||||
|
@ -943,7 +943,7 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
SkIRect bounds;
|
||||
@ -1034,7 +1034,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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() == kPMColor_SkColorType);
|
||||
SkASSERT(src.colorType() == kN32_SkColorType);
|
||||
SkASSERT(fSrcRect.width() < src.width());
|
||||
SkASSERT(fSrcRect.height() < src.height());
|
||||
|
||||
if ((src.colorType() != kPMColor_SkColorType) ||
|
||||
if ((src.colorType() != kN32_SkColorType) ||
|
||||
(fSrcRect.width() >= src.width()) ||
|
||||
(fSrcRect.height() >= src.height())) {
|
||||
return false;
|
||||
|
@ -260,7 +260,7 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src.colorType() != kPMColor_SkColorType) {
|
||||
if (src.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ uint32_t SkTransparentShader::getFlags() {
|
||||
if (fAlpha == 255)
|
||||
flags |= kOpaqueAlpha_Flag;
|
||||
break;
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
if (scale == 256) {
|
||||
SkPMColor* src = fDevice->getAddr32(x, y);
|
||||
if (src != span) {
|
||||
|
@ -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 = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
|
||||
if (NULL == fCache32PixelRef) {
|
||||
fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL);
|
||||
|
@ -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 = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
if (kOpaque_SkAlphaType != info.alphaType()) {
|
||||
info.fAlphaType = kPremul_SkAlphaType; // force this setting
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
|
||||
dstPI.fRowBytes = count * sizeof(SkPMColor);
|
||||
|
||||
SkSrcPixelInfo srcPI;
|
||||
srcPI.fColorType = kPMColor_SkColorType;
|
||||
srcPI.fColorType = kN32_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, kPMColor_SkColorType);
|
||||
origBitmap.copyTo(&tmpBitmap, kN32_SkColorType);
|
||||
// now bitmap points to our temp, which has been promoted to 32bits
|
||||
bitmap = &tmpBitmap;
|
||||
desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap->config());
|
||||
|
@ -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 kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
return kUnpremul_SkAlphaType != info.fAlphaType;
|
||||
case kRGB_565_SkColorType:
|
||||
return true;
|
||||
|
@ -20,7 +20,7 @@ SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType colorType) {
|
||||
case kRGB_565_SkColorType:
|
||||
return SkBitmap::kRGB_565_Config;
|
||||
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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
|
||||
kPMColor_SkColorType, // kARGB_8888_Config
|
||||
kN32_SkColorType, // kARGB_8888_Config
|
||||
};
|
||||
SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
|
||||
return gCT[config];
|
||||
|
@ -59,7 +59,7 @@ GrTexture* SkImage_Gpu::onGetTexture() {
|
||||
}
|
||||
|
||||
bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
|
||||
return fBitmap.copyTo(dst, kPMColor_SkColorType);
|
||||
return fBitmap.copyTo(dst, kN32_SkColorType);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -62,7 +62,7 @@ SkImage* SkSurface_Picture::onNewImageSnapshot() {
|
||||
} else {
|
||||
SkImageInfo info;
|
||||
info.fWidth = info.fHeight = 0;
|
||||
info.fColorType = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
info.fAlphaType = kOpaque_SkAlphaType;
|
||||
return SkImage::NewRasterCopy(info, NULL, 0);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) {
|
||||
case kRGB_565_SkColorType:
|
||||
shift = 1;
|
||||
break;
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
shift = 2;
|
||||
break;
|
||||
default:
|
||||
|
@ -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 = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
}
|
||||
} else {
|
||||
if (!bitmap.canCopyTo(opts.fRequestedColorType)) {
|
||||
|
@ -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, kPMColor_SkColorType);
|
||||
bm.copyTo(&bitmap8888, kN32_SkColorType);
|
||||
bmPtr = &bitmap8888;
|
||||
}
|
||||
type = kUTTypePNG;
|
||||
|
@ -306,10 +306,10 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
|
||||
//Convert to 8888 if needed.
|
||||
const SkBitmap* bitmap;
|
||||
SkBitmap bitmapCopy;
|
||||
if (kPMColor_SkColorType == bitmapOrig.colorType() && bitmapOrig.isOpaque()) {
|
||||
if (kN32_SkColorType == bitmapOrig.colorType() && bitmapOrig.isOpaque()) {
|
||||
bitmap = &bitmapOrig;
|
||||
} else {
|
||||
if (!bitmapOrig.copyTo(&bitmapCopy, kPMColor_SkColorType)) {
|
||||
if (!bitmapOrig.copyTo(&bitmapCopy, kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
bitmap = &bitmapCopy;
|
||||
|
@ -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(©Bitmap, kPMColor_SkColorType)) {
|
||||
if (!bitmap.copyTo(©Bitmap, kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
return ComputeDigestInternal(copyBitmap, result);
|
||||
|
@ -223,7 +223,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
|
||||
layerState->height = bitmap.height();
|
||||
|
||||
switch (bitmap.colorType()) {
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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 ? kPMColor_SkColorType :
|
||||
layerState.raster.config == kARGB_8888_RasterConfig ? kN32_SkColorType :
|
||||
layerState.raster.config == kRGB_565_RasterConfig ? kRGB_565_SkColorType :
|
||||
kUnknown_SkColorType;
|
||||
|
||||
|
@ -34,7 +34,7 @@ static bool getBitmapInfo(const SkBitmap& bm,
|
||||
*upscaleTo32 = true;
|
||||
}
|
||||
// fall through
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_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, kPMColor_SkColorType);
|
||||
bm.copyTo(copy, kN32_SkColorType);
|
||||
} else {
|
||||
copy = new SkBitmap(bm);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ SkWindow::SkWindow() : fFocusView(NULL) {
|
||||
#ifdef SK_BUILD_FOR_WINCE
|
||||
fColorType = kRGB_565_SkColorType;
|
||||
#else
|
||||
fColorType = kPMColor_SkColorType;
|
||||
fColorType = kN32_SkColorType;
|
||||
#endif
|
||||
|
||||
fMatrix.reset();
|
||||
|
@ -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,
|
||||
kPMColor_SkColorType);
|
||||
kN32_SkColorType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ static const Pair gPairs[] = {
|
||||
{ kIndex_8_SkColorType, "011101" },
|
||||
{ kRGB_565_SkColorType, "010101" },
|
||||
{ kARGB_4444_SkColorType, "010111" },
|
||||
{ kPMColor_SkColorType, "010111" },
|
||||
{ kN32_SkColorType, "010111" },
|
||||
};
|
||||
|
||||
static const int W = 20;
|
||||
@ -364,7 +364,7 @@ DEF_TEST(BitmapCopy, reporter) {
|
||||
}
|
||||
break;
|
||||
|
||||
case kPMColor_SkColorType:
|
||||
case kN32_SkColorType:
|
||||
if (safeSize != 0x8E1BC9BF040000LL) {
|
||||
sizeFail = true;
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ DEF_TEST(GetColor, reporter) {
|
||||
{ kAlpha_8_SkColorType, 0, 0 },
|
||||
{ kRGB_565_SkColorType, 0xFF00FF00, 0xFF00FF00 },
|
||||
{ kRGB_565_SkColorType, 0xFFFF00FF, 0xFFFF00FF },
|
||||
{ kPMColor_SkColorType, 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ kPMColor_SkColorType, 0, 0 },
|
||||
{ kPMColor_SkColorType, 0xFF224466, 0xFF224466 },
|
||||
{ kN32_SkColorType, 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ kN32_SkColorType, 0, 0 },
|
||||
{ kN32_SkColorType, 0xFF224466, 0xFF224466 },
|
||||
};
|
||||
|
||||
// specify an area that doesn't touch (0,0) and may extend beyond the
|
||||
|
@ -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 = kPMColor_SkColorType;
|
||||
info.fColorType = kN32_SkColorType;
|
||||
REPORTER_ASSERT(reporter, !bm.setConfig(info));
|
||||
}
|
||||
|
||||
|
@ -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 kPMColor_SkColorType:
|
||||
case kN32_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[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kRGB_565_SkColorType,
|
||||
};
|
||||
|
||||
@ -192,7 +192,7 @@ static void test_diagonal(skiatest::Reporter* reporter) {
|
||||
static const int H = W;
|
||||
|
||||
static const SkColorType gDstColorType[] = {
|
||||
kPMColor_SkColorType,
|
||||
kN32_SkColorType,
|
||||
kRGB_565_SkColorType,
|
||||
};
|
||||
|
||||
|
@ -189,7 +189,7 @@ public:
|
||||
}
|
||||
info->fWidth = TestImageGenerator::Width();
|
||||
info->fHeight = TestImageGenerator::Height();
|
||||
info->fColorType = kPMColor_SkColorType;
|
||||
info->fColorType = kN32_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 != kPMColor_SkColorType)) {
|
||||
|| (info.fColorType != kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
char* bytePtr = static_cast<char*>(pixels);
|
||||
|
@ -26,7 +26,7 @@ static void test_complex_layers(skiatest::Reporter* reporter) {
|
||||
SkIntToScalar((HEIGHT-(2*SPACER)) / 7));
|
||||
|
||||
const SkColorType colorTypes[] = {
|
||||
kRGB_565_SkColorType, kPMColor_SkColorType
|
||||
kRGB_565_SkColorType, kN32_SkColorType
|
||||
};
|
||||
const int configCount = sizeof(colorTypes) / sizeof(SkBitmap::Config);
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE {
|
||||
info->fWidth = 100;
|
||||
info->fHeight = 100;
|
||||
info->fColorType = kPMColor_SkColorType;
|
||||
info->fColorType = kN32_SkColorType;
|
||||
info->fAlphaType = kPremul_SkAlphaType;
|
||||
return true;
|
||||
}
|
||||
|
@ -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 kPMColor_SkColorType: return "PMColor";
|
||||
case kN32_SkColorType: return "N32";
|
||||
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.
|
||||
kPMColor_SkColorType
|
||||
kN32_SkColorType
|
||||
// Note that indexed color is left out of the list. Lazy
|
||||
// decoding doesn't do indexed color.
|
||||
};
|
||||
|
@ -381,7 +381,7 @@ DEF_GPUTEST(ReadPixels, reporter, factory) {
|
||||
SkIRect clippedRect = DEV_RECT;
|
||||
if (clippedRect.intersect(srcRect)) {
|
||||
REPORTER_ASSERT(reporter, success);
|
||||
REPORTER_ASSERT(reporter, kPMColor_SkColorType == wkbmp.colorType());
|
||||
REPORTER_ASSERT(reporter, kN32_SkColorType == wkbmp.colorType());
|
||||
REPORTER_ASSERT(reporter, kPremul_SkAlphaType == wkbmp.alphaType());
|
||||
checkRead(reporter, wkbmp, clippedRect.fLeft,
|
||||
clippedRect.fTop, true, false);
|
||||
|
@ -233,7 +233,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
|
||||
|
||||
static bool setup_bitmap_for_canvas(SkBitmap* bitmap) {
|
||||
SkImageInfo info = SkImageInfo::Make(
|
||||
kBitmapSize, kBitmapSize, kPMColor_SkColorType, kPremul_SkAlphaType);
|
||||
kBitmapSize, kBitmapSize, kN32_SkColorType, kPremul_SkAlphaType);
|
||||
return bitmap->allocPixels(info);
|
||||
}
|
||||
|
||||
|
@ -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, kPMColor_SkColorType == info.fColorType);
|
||||
REPORTER_ASSERT(reporter, kN32_SkColorType == info.fColorType);
|
||||
REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.fAlphaType ||
|
||||
kOpaque_SkAlphaType == info.fAlphaType);
|
||||
REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes);
|
||||
|
@ -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() != kPMColor_SkColorType) {
|
||||
canvasInfo.colorType() != kN32_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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(©, kPMColor_SkColorType);
|
||||
bitmap.copyTo(©, kN32_SkColorType);
|
||||
force_all_opaque(copy);
|
||||
return SkImageEncoder::EncodeFile(path.c_str(), copy,
|
||||
SkImageEncoder::kPNG_Type, 100);
|
||||
|
@ -164,7 +164,7 @@ static bool write_bitmap(const char outDir[], const char src[],
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bm.colorType() == kPMColor_SkColorType) {
|
||||
if (bm.colorType() == kN32_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, kPMColor_SkColorType)) {
|
||||
if (!bm.copyTo(&bm8888, kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
return SkImageEncoder::EncodeFile(filename.c_str(), bm8888, SkImageEncoder::kPNG_Type, 100);
|
||||
|
@ -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(©, kPMColor_SkColorType);
|
||||
diffData.fResult.poiAlphaMask.copyTo(©, kN32_SkColorType);
|
||||
SkImageEncoder::EncodeFile(newRecord->fDifferencePath.c_str(), copy,
|
||||
SkImageEncoder::kPNG_Type, 100);
|
||||
|
||||
|
@ -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() != kPMColor_SkColorType) {
|
||||
if (!bitmap->copyTo(&bm8888, kPMColor_SkColorType)) {
|
||||
if (bitmap->colorType() != kN32_SkColorType) {
|
||||
if (!bitmap->copyTo(&bm8888, kN32_SkColorType)) {
|
||||
return false;
|
||||
}
|
||||
bitmap = &bm8888;
|
||||
|
Loading…
Reference in New Issue
Block a user