diff options
-rw-r--r-- | include/core/SkBitmapDevice.h | 19 | ||||
-rw-r--r-- | include/core/SkCanvas.h | 21 | ||||
-rw-r--r-- | include/core/SkDevice.h | 22 | ||||
-rw-r--r-- | include/gpu/SkGpuDevice.h | 4 | ||||
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 69 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 16 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 8 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 22 | ||||
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 35 | ||||
-rw-r--r-- | src/utils/SkGatherPixelRefsAndRects.h | 6 | ||||
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 7 |
11 files changed, 4 insertions, 225 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index afbefc15f3..85b70f42b5 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -84,25 +84,6 @@ public: virtual SkImageInfo imageInfo() const SK_OVERRIDE; -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - /** - * DEPRECATED: This will be made protected once WebKit stops using it. - * Instead use Canvas' writePixels method. - * - * Similar to draw sprite, this method will copy the pixels in bitmap onto - * the device, with the top/left corner specified by (x, y). The pixel - * values in the device are completely replaced: there is no blending. - * - * Currently if bitmap is backed by a texture this is a no-op. This may be - * relaxed in the future. - * - * If the bitmap has config kARGB_8888_Config then the config8888 param - * will determines how the pixel valuess are intepreted. If the bitmap is - * not kARGB_8888_Config then this parameter is ignored. - */ - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE; -#endif /** * Return the device's associated gpu render target, or NULL. */ diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index b5df1e85e0..ca4010798b 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -22,7 +22,6 @@ //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG -//#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG //#define SK_SUPPORT_LEGACY_GETCLIPTYPE //#define SK_SUPPORT_LEGACY_GETTOTALCLIP //#define SK_SUPPORT_LEGACY_GETTOPDEVICE @@ -313,26 +312,6 @@ public: */ bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - /** - * DEPRECATED - * Similar to draw sprite, this method will copy the pixels in bitmap onto - * the canvas, with the top/left corner specified by (x, y). The canvas' - * pixel values are completely replaced: there is no blending. - * - * Currently if bitmap is backed by a texture this is a no-op. This may be - * relaxed in the future. - * - * If the bitmap has config kARGB_8888_Config then the config8888 param - * will determines how the pixel valuess are intepreted. If the bitmap is - * not kARGB_8888_Config then this parameter is ignored. - * - * Note: If you are recording drawing commands on this canvas to - * SkPicture, writePixels() is ignored! - */ - void writePixels(const SkBitmap& bitmap, int x, int y, Config8888 config8888); -#endif - /** * This method affects the pixels in the base-layer, and operates in pixel coordinates, * ignoring the matrix and clip. diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 3c67774489..7bb257935a 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -124,27 +124,7 @@ public: */ const SkBitmap& accessBitmap(bool changePixels); -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - /** - * DEPRECATED: This will be made protected once WebKit stops using it. - * Instead use Canvas' writePixels method. - * - * Similar to draw sprite, this method will copy the pixels in bitmap onto - * the device, with the top/left corner specified by (x, y). The pixel - * values in the device are completely replaced: there is no blending. - * - * Currently if bitmap is backed by a texture this is a no-op. This may be - * relaxed in the future. - * - * If the bitmap has config kARGB_8888_Config then the config8888 param - * will determines how the pixel valuess are intepreted. If the bitmap is - * not kARGB_8888_Config then this parameter is ignored. - */ - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888); -#endif - - bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int x, int y); + bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, int y); void* accessPixels(SkImageInfo* info, size_t* rowBytes); diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index 7394361ff1..8549595949 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -88,10 +88,6 @@ public: virtual SkBitmap::Config config() const SK_OVERRIDE; virtual void clear(SkColor color) SK_OVERRIDE; -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE; -#endif virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint& paint) SK_OVERRIDE; diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 96f4e40298..476a124647 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -199,75 +199,6 @@ bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap, return true; } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -void SkBitmapDevice::writePixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) { - if (bitmap.isNull() || bitmap.getTexture()) { - return; - } - const SkBitmap* sprite = &bitmap; - // check whether we have to handle a config8888 that doesn't match SkPMColor - if (SkBitmap::kARGB_8888_Config == bitmap.config() && - SkCanvas::kNative_Premul_Config8888 != config8888 && - kPMColorAlias != config8888) { - - // We're going to have to convert from a config8888 to the native config - // First we clip to the device bounds. - SkBitmap dstBmp = this->accessBitmap(true); - SkIRect spriteRect = SkIRect::MakeXYWH(x, y, - bitmap.width(), bitmap.height()); - SkIRect devRect = SkIRect::MakeWH(dstBmp.width(), dstBmp.height()); - if (!spriteRect.intersect(devRect)) { - return; - } - - // write directly to the device if it has pixels and is SkPMColor - bool drawSprite; - if (SkBitmap::kARGB_8888_Config == dstBmp.config() && !dstBmp.isNull()) { - // we can write directly to the dst when doing the conversion - dstBmp.extractSubset(&dstBmp, spriteRect); - drawSprite = false; - } else { - // we convert to a temporary bitmap and draw that as a sprite - if (!dstBmp.allocPixels(SkImageInfo::MakeN32Premul(spriteRect.width(), - spriteRect.height()))) { - return; - } - drawSprite = true; - } - - // copy pixels to dstBmp and convert from config8888 to native config. - SkAutoLockPixels alp(bitmap); - uint32_t* srcPixels = bitmap.getAddr32(spriteRect.fLeft - x, - spriteRect.fTop - y); - SkCopyConfig8888ToBitmap(dstBmp, - srcPixels, - bitmap.rowBytes(), - config8888); - - if (drawSprite) { - // we've clipped the sprite when we made a copy - x = spriteRect.fLeft; - y = spriteRect.fTop; - sprite = &dstBmp; - } else { - return; - } - } - - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - SkRasterClip clip(SkIRect::MakeWH(fBitmap.width(), fBitmap.height())); - SkDraw draw; - draw.fRC = &clip; - draw.fClip = &clip.bwRgn(); - draw.fBitmap = &fBitmap; // canvas should have already called accessBitmap - draw.fMatrix = &SkMatrix::I(); - this->drawSprite(draw, *sprite, x, y, paint); -} -#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 d637405445..17e03c2373 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -700,20 +700,6 @@ bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) { } } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y, - Config8888 config8888) { - SkBaseDevice* device = this->getDevice(); - if (device) { - if (SkIRect::Intersects(SkIRect::MakeSize(this->getDeviceSize()), - SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()))) { - device->accessBitmap(true); - device->writePixels(bitmap, x, y, config8888); - } - } -} -#endif - bool SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y) { if (bitmap.getTexture()) { return false; @@ -766,7 +752,7 @@ bool SkCanvas::writePixels(const SkImageInfo& origInfo, const void* pixels, size pixels = ((const char*)pixels - y * rowBytes - x * info.bytesPerPixel()); // The device can assert that the requested area is always contained in its bounds - return device->writePixelsDirect(info, pixels, rowBytes, target.x(), target.y()); + return device->writePixels(info, pixels, rowBytes, target.x(), target.y()); } SkCanvas* SkCanvas::canvasForDrawIter() { diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 3cfe89cfec..5b6ecc07f8 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -171,8 +171,8 @@ void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, this->drawPath(draw, path, paint, preMatrix, pathIsMutable); } -bool SkBaseDevice::writePixelsDirect(const SkImageInfo& info, const void* pixels, size_t rowBytes, - int x, int y) { +bool SkBaseDevice::writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, + int x, int y) { #ifdef SK_DEBUG SkASSERT(info.width() > 0 && info.height() > 0); SkASSERT(pixels); @@ -210,10 +210,6 @@ void* SkBaseDevice::onAccessPixels(SkImageInfo* info, size_t* rowBytes) { return NULL; } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -void SkBaseDevice::writePixels(const SkBitmap&, int x, int y, SkCanvas::Config8888) {} -#endif - void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) { // The base class doesn't perform any analysis but derived classes may } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index a86170b75e..26392cab26 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -394,28 +394,6 @@ bool SkGpuDevice::onReadPixels(const SkBitmap& bitmap, flags); } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -void SkGpuDevice::writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) { - SkAutoLockPixels alp(bitmap); - if (!bitmap.readyToDraw()) { - return; - } - - GrPixelConfig config; - uint32_t flags; - if (SkBitmap::kARGB_8888_Config == bitmap.config()) { - config = config8888_to_grconfig_and_flags(config8888, &flags); - } else { - flags = 0; - config= SkBitmapConfig2GrPixelConfig(bitmap.config()); - } - - fRenderTarget->writePixels(x, y, bitmap.width(), bitmap.height(), - config, bitmap.getPixels(), bitmap.rowBytes(), flags); -} -#endif - bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y) { // TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 984fe05b2b..9051874870 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -167,10 +167,6 @@ public: virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE; -#endif virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; protected: @@ -473,37 +469,6 @@ void SkDeferredDevice::prepareForImmediatePixelWrite() { fImmediateCanvas->flush(); } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG -void SkDeferredDevice::writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) { - - if (x <= 0 && y <= 0 && (x + bitmap.width()) >= width() && - (y + bitmap.height()) >= height()) { - this->skipPendingCommands(); - } - - if (SkBitmap::kARGB_8888_Config == bitmap.config() && - SkCanvas::kNative_Premul_Config8888 != config8888 && - kPMColorAlias != config8888) { - //Special case config: no deferral - prepareForImmediatePixelWrite(); - immediateDevice()->writePixels(bitmap, x, y, config8888); - return; - } - - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - if (shouldDrawImmediately(&bitmap, NULL, getBitmapSizeThreshold())) { - prepareForImmediatePixelWrite(); - fImmediateCanvas->drawSprite(bitmap, x, y, &paint); - } else { - this->recordingCanvas()->drawSprite(bitmap, x, y, &paint); - this->recordedDrawCommand(); - - } -} -#endif - bool SkDeferredDevice::onWritePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y) { SkASSERT(x >= 0 && y >= 0); diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h index a6ff16daf3..1c9d6fc361 100644 --- a/src/utils/SkGatherPixelRefsAndRects.h +++ b/src/utils/SkGatherPixelRefsAndRects.h @@ -47,12 +47,6 @@ public: return fEmptyBitmap.info(); } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE { - NotSupported(); - } -#endif virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } protected: diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 23d7afd7a2..78d70ca4eb 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -85,13 +85,6 @@ public: nothing_to_do(); } -#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG - virtual void writePixels(const SkBitmap& bitmap, int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE { - not_supported(); - } -#endif - virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE { this->addBitmapFromPaint(paint); } |