aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:55:37 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:55:37 +0000
commit900ecf2f1579d42c9d2959831787af0346320f86 (patch)
tree243e1157f2675f3e62b61505e0929ade2a05da93 /src
parent0a2bf90dccba3bde188e0386a7f0c60e6dde1ae9 (diff)
use colortype instead of config
patch from issue 172063004 BUG=skia: R=scroggo@google.com Review URL: https://codereview.chromium.org/173893002 git-svn-id: http://skia.googlecode.com/svn/trunk@13520 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapFilter.cpp4
-rw-r--r--src/core/SkBitmapProcShader.cpp32
-rw-r--r--src/core/SkBitmapScaler.cpp8
-rw-r--r--src/core/SkBitmap_scroll.cpp22
-rw-r--r--src/core/SkBlitter.cpp20
-rw-r--r--src/core/SkBlitter_Sprite.cpp6
-rw-r--r--src/core/SkCanvas.cpp6
-rw-r--r--src/core/SkDevice.cpp3
-rw-r--r--src/core/SkDraw.cpp30
-rw-r--r--src/core/SkScaledImageCache.cpp7
-rw-r--r--src/core/SkScalerContext.cpp4
-rw-r--r--src/core/SkSpriteBlitter_ARGB32.cpp8
-rw-r--r--src/core/SkSpriteBlitter_RGB16.cpp10
-rw-r--r--src/device/xps/SkXPSDevice.cpp3
-rw-r--r--src/lazy/SkDiscardablePixelRef.cpp2
-rw-r--r--src/pdf/SkPDFDevice.cpp12
-rw-r--r--src/utils/SkPictureUtils.cpp2
17 files changed, 80 insertions, 99 deletions
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index 7443cb61b7..1653cbb20e 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -123,8 +123,8 @@ bool SkBitmapProcState::setBitmapFilterProcs() {
return false;
}
- // TODO: consider supporting other configs (e.g. 565, A8)
- if (fBitmap->config() != SkBitmap::kARGB_8888_Config) {
+ // TODO: consider supporting other colortypes (e.g. 565, A8)
+ if (fBitmap->colorType() != kPMColor_SkColorType) {
return false;
}
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index d7c7269c89..74b9e86669 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -18,11 +18,11 @@
#endif
bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
- switch (bm.config()) {
- case SkBitmap::kA8_Config:
- case SkBitmap::kRGB_565_Config:
- case SkBitmap::kIndex8_Config:
- case SkBitmap::kARGB_8888_Config:
+ switch (bm.colorType()) {
+ case kAlpha_8_SkColorType:
+ case kRGB_565_SkColorType:
+ case kIndex_8_SkColorType:
+ case kPMColor_SkColorType:
// if (tx == ty && (kClamp_TileMode == tx || kRepeat_TileMode == tx))
return true;
default:
@@ -88,7 +88,7 @@ static bool valid_for_drawing(const SkBitmap& bm) {
if (NULL == bm.pixelRef()) {
return false; // no pixels to read
}
- if (SkBitmap::kIndex8_Config == bm.config()) {
+ if (kIndex_8_SkColorType == bm.colorType()) {
// ugh, I have to lock-pixels to inspect the colortable
SkAutoLockPixels alp(bm);
if (!bm.getColorTable()) {
@@ -125,23 +125,23 @@ bool SkBitmapProcShader::setContext(const SkBitmap& device,
flags |= kOpaqueAlpha_Flag;
}
- switch (bitmap.config()) {
- case SkBitmap::kRGB_565_Config:
+ switch (bitmap.colorType()) {
+ case kRGB_565_SkColorType:
flags |= (kHasSpan16_Flag | kIntrinsicly16_Flag);
break;
- case SkBitmap::kIndex8_Config:
- case SkBitmap::kARGB_8888_Config:
+ case kIndex_8_SkColorType:
+ case kPMColor_SkColorType:
if (bitmapIsOpaque) {
flags |= kHasSpan16_Flag;
}
break;
- case SkBitmap::kA8_Config:
+ case kAlpha_8_SkColorType:
break; // never set kHasSpan16_Flag
default:
break;
}
- if (paint.isDither() && bitmap.config() != SkBitmap::kRGB_565_Config) {
+ if (paint.isDither() && bitmap.colorType() != kRGB_565_SkColorType) {
// gradients can auto-dither in their 16bit sampler, but we don't so
// we clear the flag here.
flags &= ~kHasSpan16_Flag;
@@ -278,14 +278,14 @@ static bool canUseColorShader(const SkBitmap& bm, SkColor* color) {
return false;
}
- switch (bm.config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (bm.colorType()) {
+ case kPMColor_SkColorType:
*color = SkUnPreMultiply::PMColorToColor(*bm.getAddr32(0, 0));
return true;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
*color = SkPixel16ToColor(*bm.getAddr16(0, 0));
return true;
- case SkBitmap::kIndex8_Config:
+ case kIndex_8_SkColorType:
*color = SkUnPreMultiply::PMColorToColor(bm.getIndex8Color(0, 0));
return true;
default: // just skip the other configs for now
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index dc50464e54..a90be05d63 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -275,7 +275,7 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
SkAutoLockPixels locker(source);
if (!source.readyToDraw() ||
- source.config() != SkBitmap::kARGB_8888_Config) {
+ source.colorType() != kPMColor_SkColorType) {
return false;
}
@@ -290,9 +290,9 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
// Convolve into the result.
SkBitmap result;
- result.setConfig(SkBitmap::kARGB_8888_Config,
- destSubset.width(), destSubset.height(), 0,
- source.alphaType());
+ result.setConfig(SkImageInfo::MakeN32(destSubset.width(),
+ destSubset.height(),
+ source.alphaType()));
result.allocPixels(allocator, NULL);
if (!result.readyToDraw()) {
return false;
diff --git a/src/core/SkBitmap_scroll.cpp b/src/core/SkBitmap_scroll.cpp
index e9c886f4a0..00a72aa1ca 100644
--- a/src/core/SkBitmap_scroll.cpp
+++ b/src/core/SkBitmap_scroll.cpp
@@ -11,7 +11,7 @@
bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
SkRegion* inval) const
{
- if (this->isImmutable()) {
+ if (this->isImmutable() || kUnknown_SkColorType == this->colorType()) {
return false;
}
@@ -23,25 +23,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
tmp.scrollRect(NULL, dx, dy, inval);
}
- int shift;
-
- switch (this->config()) {
- case kIndex8_Config:
- case kA8_Config:
- shift = 0;
- break;
- case kARGB_4444_Config:
- case kRGB_565_Config:
- shift = 1;
- break;
- case kARGB_8888_Config:
- shift = 2;
- break;
- default:
- // can't scroll this config
- return false;
- }
-
+ int shift = this->bytesPerPixel() >> 1;
int width = this->width();
int height = this->height();
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 31a3edea76..98325c0245 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -812,7 +812,7 @@ enum XferInterp {
};
static XferInterp interpret_xfermode(const SkPaint& paint, SkXfermode* xfer,
- SkBitmap::Config deviceConfig) {
+ SkColorType deviceCT) {
SkXfermode::Mode mode;
if (SkXfermode::AsMode(xfer, &mode)) {
@@ -827,12 +827,12 @@ static XferInterp interpret_xfermode(const SkPaint& paint, SkXfermode* xfer,
case SkXfermode::kSrcOver_Mode:
return kSrcOver_XferInterp;
case SkXfermode::kDstOver_Mode:
- if (SkBitmap::kRGB_565_Config == deviceConfig) {
+ if (kRGB_565_SkColorType == deviceCT) {
return kSkipDrawing_XferInterp;
}
break;
case SkXfermode::kSrcIn_Mode:
- if (SkBitmap::kRGB_565_Config == deviceConfig &&
+ if (kRGB_565_SkColorType == deviceCT &&
just_solid_color(paint)) {
return kSrcOver_XferInterp;
}
@@ -860,8 +860,8 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
// which check, in case we're being called by a client with a dummy device
// (e.g. they have a bounder that always aborts the draw)
- if (SkBitmap::kNo_Config == device.config() ||
- (drawCoverage && (SkBitmap::kA8_Config != device.config()))) {
+ if (kUnknown_SkColorType == device.colorType() ||
+ (drawCoverage && (kAlpha_8_SkColorType != device.colorType()))) {
SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize);
return blitter;
}
@@ -882,7 +882,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
}
if (NULL != mode) {
- switch (interpret_xfermode(*paint, mode, device.config())) {
+ switch (interpret_xfermode(*paint, mode, device.colorType())) {
case kSrcOver_XferInterp:
mode = NULL;
paint.writable()->setXfermode(NULL);
@@ -945,8 +945,8 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
}
- switch (device.config()) {
- case SkBitmap::kA8_Config:
+ switch (device.colorType()) {
+ case kAlpha_8_SkColorType:
if (drawCoverage) {
SkASSERT(NULL == shader);
SkASSERT(NULL == paint->getXfermode());
@@ -961,11 +961,11 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
}
break;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
blitter = SkBlitter_ChooseD565(device, *paint, storage, storageSize);
break;
- case SkBitmap::kARGB_8888_Config:
+ case kPMColor_SkColorType:
if (shader) {
SK_PLACEMENT_NEW_ARGS(blitter, SkARGB32_Shader_Blitter,
storage, storageSize, (device, *paint));
diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp
index 9322e20396..86251ff59f 100644
--- a/src/core/SkBlitter_Sprite.cpp
+++ b/src/core/SkBlitter_Sprite.cpp
@@ -66,12 +66,12 @@ SkBlitter* SkBlitter::ChooseSprite( const SkBitmap& device,
SkSpriteBlitter* blitter;
- switch (device.config()) {
- case SkBitmap::kRGB_565_Config:
+ switch (device.colorType()) {
+ case kRGB_565_SkColorType:
blitter = SkSpriteBlitter::ChooseD16(source, paint, storage,
storageSize);
break;
- case SkBitmap::kARGB_8888_Config:
+ case kPMColor_SkColorType:
blitter = SkSpriteBlitter::ChooseD32(source, paint, storage,
storageSize);
break;
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 4462b4cc2a..93dc14bd1e 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -518,7 +518,7 @@ SkCanvas::SkCanvas(int width, int height)
inc_canvas();
SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kNo_Config, width, height);
+ bitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
}
@@ -950,9 +950,7 @@ SkImageInfo SkCanvas::imageInfo() const {
if (dev) {
return dev->imageInfo();
} else {
- // TODO: need a real unknown for alphatype it seems.
- SkAlphaType unknownAlphaType = kIgnore_SkAlphaType;
- return SkImageInfo::Make(0, 0, kUnknown_SkColorType, unknownAlphaType);
+ return SkImageInfo::MakeUnknown(0, 0);
}
}
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index d69e4afab2..40663b2e03 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -101,8 +101,7 @@ SkMetaData& SkBaseDevice::getMetaData() {
// TODO: should make this guy pure-virtual.
SkImageInfo SkBaseDevice::imageInfo() const {
- return SkImageInfo::Make(this->width(), this->height(),
- kUnknown_SkColorType, kIgnore_SkAlphaType);
+ return SkImageInfo::MakeUnknown(this->width(), this->height());
}
const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 5f81073068..175abb6844 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -200,20 +200,20 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
should I worry about dithering for the lower depths?
*/
SkPMColor pmc = SkPreMultiplyColor(color);
- switch (bitmap.config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (bitmap.colorType()) {
+ case kPMColor_SkColorType:
if (data) {
*data = pmc;
}
// SkDebugf("--- D32_Src_BitmapXferProc\n");
return D32_Src_BitmapXferProc;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
if (data) {
*data = SkPixel32ToPixel16(pmc);
}
// SkDebugf("--- D16_Src_BitmapXferProc\n");
return D16_Src_BitmapXferProc;
- case SkBitmap::kA8_Config:
+ case kAlpha_8_SkColorType:
if (data) {
*data = SkGetPackedA32(pmc);
}
@@ -233,14 +233,14 @@ static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
static void CallBitmapXferProc(const SkBitmap& bitmap, const SkIRect& rect,
BitmapXferProc proc, uint32_t procData) {
int shiftPerPixel;
- switch (bitmap.config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (bitmap.colorType()) {
+ case kPMColor_SkColorType:
shiftPerPixel = 2;
break;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
shiftPerPixel = 1;
break;
- case SkBitmap::kA8_Config:
+ case kAlpha_8_SkColorType:
shiftPerPixel = 0;
break;
default:
@@ -526,9 +526,9 @@ PtProcRec::Proc PtProcRec::chooseProc(SkBlitter** blitterPtr) {
if (SkCanvas::kPoints_PointMode == fMode && fClip->isRect()) {
uint32_t value;
const SkBitmap* bm = blitter->justAnOpaqueColor(&value);
- if (bm && SkBitmap::kRGB_565_Config == bm->config()) {
+ if (bm && kRGB_565_SkColorType == bm->colorType()) {
proc = bw_pt_rect_16_hair_proc;
- } else if (bm && SkBitmap::kARGB_8888_Config == bm->config()) {
+ } else if (bm && kPMColor_SkColorType == bm->colorType()) {
proc = bw_pt_rect_32_hair_proc;
} else {
proc = bw_pt_rect_hair_proc;
@@ -1176,7 +1176,7 @@ static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) {
void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
const SkPaint& paint) const {
- SkASSERT(bitmap.config() == SkBitmap::kA8_Config);
+ SkASSERT(bitmap.colorType() == kAlpha_8_SkColorType);
if (just_translate(*fMatrix, bitmap)) {
int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
@@ -1284,7 +1284,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
// nothing to draw
if (fRC->isEmpty() ||
bitmap.width() == 0 || bitmap.height() == 0 ||
- bitmap.config() == SkBitmap::kNo_Config) {
+ bitmap.colorType() == kUnknown_SkColorType) {
return;
}
@@ -1310,7 +1310,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
}
}
- if (bitmap.config() != SkBitmap::kA8_Config &&
+ if (bitmap.colorType() != kAlpha_8_SkColorType &&
just_translate(matrix, bitmap)) {
//
// It is safe to call lock pixels now, since we know the matrix is
@@ -1343,7 +1343,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
SkDraw draw(*this);
draw.fMatrix = &matrix;
- if (bitmap.config() == SkBitmap::kA8_Config) {
+ if (bitmap.colorType() == kAlpha_8_SkColorType) {
draw.drawBitmapAsMask(bitmap, paint);
} else {
SkAutoBitmapShaderInstall install(bitmap, paint);
@@ -1363,7 +1363,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y,
// nothing to draw
if (fRC->isEmpty() ||
bitmap.width() == 0 || bitmap.height() == 0 ||
- bitmap.config() == SkBitmap::kNo_Config) {
+ bitmap.colorType() == kUnknown_SkColorType) {
return;
}
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
index 6a1264eb6a..f0f34ccbf1 100644
--- a/src/core/SkScaledImageCache.cpp
+++ b/src/core/SkScaledImageCache.cpp
@@ -289,13 +289,12 @@ bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
return false;
}
- // can relax when we have bitmap::asImageInfo
- if (SkBitmap::kARGB_8888_Config != bitmap->config()) {
+ // can we relax this?
+ if (kPMColor_SkColorType != bitmap->colorType()) {
return false;
}
- SkImageInfo info = SkImageInfo::MakeN32(bitmap->width(), bitmap->height(),
- bitmap->alphaType());
+ SkImageInfo info = bitmap->info();
bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
(info, dm, bitmap->rowBytes())))->unref();
bitmap->lockPixels();
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 1c14877667..d0d24eebe8 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -428,7 +428,7 @@ static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst,
const SkMaskGamma::PreBlend& maskPreBlend) {
#define SAMPLES_PER_PIXEL 4
#define LCD_PER_PIXEL 3
- SkASSERT(SkBitmap::kA8_Config == src.config());
+ SkASSERT(kAlpha_8_SkColorType == src.colorType());
SkASSERT(SkMask::kLCD16_Format == dst.fFormat);
const int sample_width = src.width();
@@ -502,7 +502,7 @@ static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst,
template<bool APPLY_PREBLEND>
static void pack4xHToLCD32(const SkBitmap& src, const SkMask& dst,
const SkMaskGamma::PreBlend& maskPreBlend) {
- SkASSERT(SkBitmap::kA8_Config == src.config());
+ SkASSERT(kAlpha_8_SkColorType == src.colorType());
SkASSERT(SkMask::kLCD32_Format == dst.fFormat);
const int width = dst.fBounds.width();
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index 8255336c65..3e8612dda3 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -20,7 +20,7 @@
class Sprite_D32_S32 : public SkSpriteBlitter {
public:
Sprite_D32_S32(const SkBitmap& src, U8CPU alpha) : INHERITED(src) {
- SkASSERT(src.config() == SkBitmap::kARGB_8888_Config);
+ SkASSERT(src.colorType() == kPMColor_SkColorType);
unsigned flags32 = 0;
if (255 != alpha) {
@@ -277,8 +277,8 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source,
SkColorFilter* filter = paint.getColorFilter();
SkSpriteBlitter* blitter = NULL;
- switch (source.config()) {
- case SkBitmap::kARGB_4444_Config:
+ switch (source.colorType()) {
+ case kARGB_4444_SkColorType:
if (alpha != 0xFF) {
return NULL; // we only have opaque sprites
}
@@ -293,7 +293,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source,
storage, storageSize, (source));
}
break;
- case SkBitmap::kARGB_8888_Config:
+ case kPMColor_SkColorType:
if (xfermode || filter) {
if (255 == alpha) {
// this can handle xfermode or filter, but not alpha
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 2bce41e993..7428c8a74a 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -324,12 +324,12 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source,
SkSpriteBlitter* blitter = NULL;
unsigned alpha = paint.getAlpha();
- switch (source.config()) {
- case SkBitmap::kARGB_8888_Config:
+ switch (source.colorType()) {
+ case kPMColor_SkColorType:
SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D16_S32_BlitRowProc,
storage, storageSize, (source));
break;
- case SkBitmap::kARGB_4444_Config:
+ case kARGB_4444_SkColorType:
if (255 == alpha) {
SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D16_S4444_Opaque,
storage, storageSize, (source));
@@ -338,7 +338,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source,
storage, storageSize, (source, alpha >> 4));
}
break;
- case SkBitmap::kRGB_565_Config:
+ case kRGB_565_SkColorType:
if (255 == alpha) {
SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D16_S16_Opaque,
storage, storageSize, (source));
@@ -347,7 +347,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source,
storage, storageSize, (source, alpha));
}
break;
- case SkBitmap::kIndex8_Config:
+ case kIndex_8_SkColorType:
if (paint.isDither()) {
// we don't support dither yet in these special cases
break;
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 7b97d3f8b5..f2901316c2 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -106,10 +106,11 @@ static HRESULT create_id(wchar_t* buffer, size_t bufferSize,
static SkBitmap make_fake_bitmap(int width, int height) {
SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kNo_Config, width, height);
+ bitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
return bitmap;
}
+// TODO: should inherit from SkBaseDevice instead of SkBitmapDevice...
SkXPSDevice::SkXPSDevice()
: SkBitmapDevice(make_fake_bitmap(10000, 10000))
, fCurrentPage(0) {
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 0878d00335..56b94b734e 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -87,7 +87,7 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator,
|| (!dst->setConfig(info, 0))) {
return false;
}
- SkASSERT(dst->config() != SkBitmap::kNo_Config);
+ SkASSERT(dst->colorType() != kUnknown_SkColorType);
if (dst->empty()) { // Use a normal pixelref.
return dst->allocPixels();
}
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index a7ef08d21d..ff3878b803 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -704,7 +704,7 @@ private:
static inline SkBitmap makeContentBitmap(const SkISize& contentSize,
const SkMatrix* initialTransform) {
- SkBitmap bitmap;
+ SkImageInfo info;
if (initialTransform) {
// Compute the size of the drawing area.
SkVector drawingSize;
@@ -718,17 +718,19 @@ static inline SkBitmap makeContentBitmap(const SkISize& contentSize,
}
inverse.mapVectors(&drawingSize, 1);
SkISize size = SkSize::Make(drawingSize.fX, drawingSize.fY).toRound();
- bitmap.setConfig(SkBitmap::kNo_Config, abs(size.fWidth),
- abs(size.fHeight));
+ info = SkImageInfo::MakeUnknown(abs(size.fWidth), abs(size.fHeight));
} else {
- bitmap.setConfig(SkBitmap::kNo_Config, abs(contentSize.fWidth),
- abs(contentSize.fHeight));
+ info = SkImageInfo::MakeUnknown(abs(contentSize.fWidth),
+ abs(contentSize.fHeight));
}
+ SkBitmap bitmap;
+ bitmap.setConfig(info);
return bitmap;
}
// TODO(vandebo) change pageSize to SkSize.
+// TODO: inherit from SkBaseDevice instead of SkBitmapDevice
SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
const SkMatrix& initialTransform)
: SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)),
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index a7ec7aea0e..cda64052c3 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -54,7 +54,7 @@ public:
GatherPixelRefDevice(int width, int height, PixelRefSet* prset) {
fSize.set(width, height);
- fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height);
+ fEmptyBitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
fPRSet = prset;
}