diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 28 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 12 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 48 | ||||
-rw-r--r-- | src/device/xps/SkXPSDevice.cpp | 7 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 53 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 7 | ||||
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 14 |
7 files changed, 0 insertions, 169 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index d968cb850b..dd43e963e6 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -173,34 +173,6 @@ bool SkBitmapDevice::allowImageFilter(const SkImageFilter*) { return true; } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) { - SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config()); - SkASSERT(!bitmap.isNull()); - SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::MakeXYWH(x, y, - bitmap.width(), - bitmap.height()))); - - SkIRect srcRect = SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()); - const SkBitmap& src = this->accessBitmap(false); - - SkBitmap subset; - if (!src.extractSubset(&subset, srcRect)) { - return false; - } - if (kPMColor_SkColorType != subset.colorType()) { - // It'd be preferable to do this directly to bitmap. - subset.copyTo(&subset, kPMColor_SkColorType); - } - SkAutoLockPixels alp(bitmap); - uint32_t* bmpPixels = reinterpret_cast<uint32_t*>(bitmap.getPixels()); - SkCopyBitmapToConfig8888(bmpPixels, bitmap.rowBytes(), config8888, subset); - return true; -} -#endif - void* SkBitmapDevice::onAccessPixels(SkImageInfo* info, size_t* rowBytes) { if (fBitmap.getPixels()) { *info = fBitmap.info(); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 73ea488540..e8336fffff 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -667,18 +667,6 @@ SkBaseDevice* SkCanvas::setRootDevice(SkBaseDevice* device) { return device; } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkCanvas::readPixels(SkBitmap* bitmap, - int x, int y, - Config8888 config8888) { - SkBaseDevice* device = this->getDevice(); - if (!device) { - return false; - } - return device->readPixels(bitmap, x, y, config8888); -} -#endif - bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) { if (kUnknown_SkColorType == bitmap->colorType() || bitmap->getTexture()) { return false; diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 4c75a36363..299d44533d 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -102,54 +102,6 @@ const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { return bitmap; } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, - SkCanvas::Config8888 config8888) { - if (SkBitmap::kARGB_8888_Config != bitmap->config() || - NULL != bitmap->getTexture()) { - return false; - } - - const SkBitmap& src = this->accessBitmap(false); - - SkIRect srcRect = SkIRect::MakeXYWH(x, y, bitmap->width(), - bitmap->height()); - SkIRect devbounds = SkIRect::MakeWH(src.width(), src.height()); - if (!srcRect.intersect(devbounds)) { - return false; - } - - SkBitmap tmp; - SkBitmap* bmp; - if (bitmap->isNull()) { - if (!tmp.allocPixels(SkImageInfo::MakeN32Premul(bitmap->width(), - bitmap->height()))) { - return false; - } - bmp = &tmp; - } else { - bmp = bitmap; - } - - SkIRect subrect = srcRect; - subrect.offset(-x, -y); - SkBitmap bmpSubset; - bmp->extractSubset(&bmpSubset, subrect); - - bool result = this->onReadPixels(bmpSubset, - srcRect.fLeft, - srcRect.fTop, - config8888); - if (result && bmp == &tmp) { - tmp.swap(*bitmap); - } - return result; -} -bool SkBaseDevice::onReadPixels(const SkBitmap&, int x, int y, SkCanvas::Config8888) { - return false; -} -#endif - SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index 05ab13a09c..389db1dbe1 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -2408,13 +2408,6 @@ void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev, "Could not add layer to current visuals."); } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkXPSDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888) { - return false; -} -#endif - SkBaseDevice* SkXPSDevice::onCreateDevice(const SkImageInfo&, Usage) { //Conditional for bug compatibility with PDF device. #if 0 diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 2a1b980aa9..a849c84e4e 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -343,59 +343,6 @@ void SkGpuDevice::makeRenderTargetCurrent() { /////////////////////////////////////////////////////////////////////////////// -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -namespace { -GrPixelConfig config8888_to_grconfig_and_flags(SkCanvas::Config8888 config8888, uint32_t* flags) { - switch (config8888) { - case SkCanvas::kNative_Premul_Config8888: - *flags = 0; - return kSkia8888_GrPixelConfig; - case SkCanvas::kNative_Unpremul_Config8888: - *flags = GrContext::kUnpremul_PixelOpsFlag; - return kSkia8888_GrPixelConfig; - case SkCanvas::kBGRA_Premul_Config8888: - *flags = 0; - return kBGRA_8888_GrPixelConfig; - case SkCanvas::kBGRA_Unpremul_Config8888: - *flags = GrContext::kUnpremul_PixelOpsFlag; - return kBGRA_8888_GrPixelConfig; - case SkCanvas::kRGBA_Premul_Config8888: - *flags = 0; - return kRGBA_8888_GrPixelConfig; - case SkCanvas::kRGBA_Unpremul_Config8888: - *flags = GrContext::kUnpremul_PixelOpsFlag; - return kRGBA_8888_GrPixelConfig; - default: - GrCrash("Unexpected Config8888."); - *flags = 0; // suppress warning - return kSkia8888_GrPixelConfig; - } -} -} - -bool SkGpuDevice::onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) { - DO_DEFERRED_CLEAR(); - SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config()); - SkASSERT(!bitmap.isNull()); - SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()))); - - SkAutoLockPixels alp(bitmap); - GrPixelConfig config; - uint32_t flags; - config = config8888_to_grconfig_and_flags(config8888, &flags); - return fContext->readRenderTargetPixels(fRenderTarget, - x, y, - bitmap.width(), - bitmap.height(), - config, - bitmap.getPixels(), - bitmap.rowBytes(), - flags); -} -#endif - bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int x, int y) { DO_DEFERRED_CLEAR(); diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index b8e6818741..246f30ded1 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -2307,13 +2307,6 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix, &content.entry()->fContent); } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888) { - return false; -} -#endif - bool SkPDFDevice::allowImageFilter(const SkImageFilter*) { return false; } diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 12ccb9aba2..2c5e5301c0 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -171,11 +171,6 @@ public: protected: virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG - virtual bool onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE; -#endif virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) SK_OVERRIDE; virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y) SK_OVERRIDE; @@ -509,15 +504,6 @@ SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info) { return this->immediateDevice()->newSurface(info); } -#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG -bool SkDeferredDevice::onReadPixels( - const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) { - this->flushPendingCommands(kNormal_PlaybackMode); - return fImmediateCanvas->readPixels(const_cast<SkBitmap*>(&bitmap), - x, y, config8888); -} -#endif - bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, int x, int y) { this->flushPendingCommands(kNormal_PlaybackMode); |