Make SkImage_Base::onReadPixels() pure virtual

BUG=skia:

Change-Id: I52504b21313717bf8321ec3f1df770773703a1a1
Reviewed-on: https://skia-review.googlesource.com/6831
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
This commit is contained in:
Matt Sarett 2017-01-10 09:29:04 -05:00 committed by Skia Commit-Bot
parent 0ab977f231
commit e260959446
2 changed files with 1 additions and 33 deletions

View File

@ -200,20 +200,6 @@ GrBackendObject SkImage::getTextureHandle(bool) const { return 0; }
///////////////////////////////////////////////////////////////////////////////
static bool raster_canvas_supports(const SkImageInfo& info) {
switch (info.colorType()) {
case kN32_SkColorType:
return kUnpremul_SkAlphaType != info.alphaType();
case kRGB_565_SkColorType:
return true;
case kAlpha_8_SkColorType:
return true;
default:
break;
}
return false;
}
SkImage_Base::SkImage_Base(int width, int height, uint32_t uniqueID)
: INHERITED(width, height, uniqueID)
, fAddedToCache(false)
@ -225,23 +211,6 @@ SkImage_Base::~SkImage_Base() {
}
}
bool SkImage_Base::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, CachingHint) const {
if (!raster_canvas_supports(dstInfo)) {
return false;
}
SkBitmap bm;
bm.installPixels(dstInfo, dstPixels, dstRowBytes);
SkCanvas canvas(bm);
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
canvas.drawImage(this, -SkIntToScalar(srcX), -SkIntToScalar(srcY), &paint);
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint chint) const {

View File

@ -40,9 +40,8 @@ public:
virtual const SkBitmap* onPeekBitmap() const { return nullptr; }
// Default impl calls onDraw
virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, CachingHint) const;
int srcX, int srcY, CachingHint) const = 0;
virtual GrTexture* peekTexture() const { return nullptr; }
#if SK_SUPPORT_GPU