diff options
-rw-r--r-- | src/image/SkImage.cpp | 31 | ||||
-rw-r--r-- | src/image/SkImage_Base.h | 3 |
2 files changed, 1 insertions, 33 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 66301341d3..417a29a1ed 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -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 { diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index ebb38d4731..e839a05cd2 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -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 |