aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-26 13:44:58 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-26 13:44:58 +0000
commitf20fc24a7def23093a1abd2fc8de4a1302aeb9f8 (patch)
tree1debba462b64f41fa28b5b2c146c72478f7c1887
parentda0ceb22995640c766a929369bf4b704fcd33418 (diff)
remove all references to legacy Config8888
BUG=skia: R=bsalomon@google.com Review URL: https://codereview.chromium.org/211043002 git-svn-id: http://skia.googlecode.com/svn/trunk@13952 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkBitmapDevice.h10
-rw-r--r--include/core/SkCanvas.h87
-rw-r--r--include/core/SkDevice.h49
-rw-r--r--include/device/xps/SkXPSDevice.h7
-rw-r--r--include/gpu/SkGpuDevice.h3
-rw-r--r--include/pdf/SkPDFDevice.h4
-rw-r--r--src/core/SkBitmapDevice.cpp28
-rw-r--r--src/core/SkCanvas.cpp12
-rw-r--r--src/core/SkDevice.cpp48
-rw-r--r--src/device/xps/SkXPSDevice.cpp7
-rw-r--r--src/gpu/SkGpuDevice.cpp53
-rw-r--r--src/pdf/SkPDFDevice.cpp7
-rw-r--r--src/utils/SkDeferredCanvas.cpp14
13 files changed, 1 insertions, 328 deletions
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index 076fb8ab89..df4675e5e3 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -188,16 +188,6 @@ protected:
return pr;
}
- /**
- * Implements readPixels API. The caller will ensure that:
- * 1. bitmap has pixel config kARGB_8888_Config.
- * 2. bitmap has pixels.
- * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
- * contained in the device bounds.
- */
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- virtual bool onReadPixels(const SkBitmap&, int x, int y, SkCanvas::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, int) SK_OVERRIDE;
virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRIDE;
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 332cbefcb3..3eadb4ccca 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -18,14 +18,6 @@
#include "SkRegion.h"
#include "SkXfermode.h"
-//#define SK_SUPPORT_LEGACY_READPIXELSCONFIG
-
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- #ifndef SK_SUPPORT_LEGACY_CONFIG8888
- #define SK_SUPPORT_LEGACY_CONFIG8888
- #endif
-#endif
-
// if not defined, we always assume ClipToLayer for saveLayer()
//#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
@@ -237,83 +229,6 @@ public:
*/
const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
-#ifdef SK_SUPPORT_LEGACY_CONFIG8888
- /**
- * This enum can be used with read/writePixels to perform a pixel ops to or
- * from an 8888 config other than Skia's native config (SkPMColor). There
- * are three byte orders supported: native, BGRA, and RGBA. Each has a
- * premultiplied and unpremultiplied variant.
- *
- * Components of a 8888 pixel can be packed/unpacked from a 32bit word using
- * either byte offsets or shift values. Byte offsets are endian-invariant
- * while shifts are not. BGRA and RGBA configs are defined by byte
- * orderings. The native config is defined by shift values (SK_A32_SHIFT,
- * ..., SK_B32_SHIFT).
- */
- enum Config8888 {
- /**
- * Skia's native order specified by:
- * SK_A32_SHIFT, SK_R32_SHIFT, SK_G32_SHIFT, and SK_B32_SHIFT
- *
- * kNative_Premul_Config8888 is equivalent to SkPMColor
- * kNative_Unpremul_Config8888 has the same component order as SkPMColor
- * but is not premultiplied.
- */
- kNative_Premul_Config8888,
- kNative_Unpremul_Config8888,
- /**
- * low byte to high byte: B, G, R, A.
- */
- kBGRA_Premul_Config8888,
- kBGRA_Unpremul_Config8888,
- /**
- * low byte to high byte: R, G, B, A.
- */
- kRGBA_Premul_Config8888,
- kRGBA_Unpremul_Config8888
- };
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- /**
- * On success (returns true), copy the canvas pixels into the bitmap.
- * On failure, the bitmap parameter is left unchanged and false is
- * returned.
- *
- * The canvas' pixels are converted to the bitmap's config. The only
- * supported config is kARGB_8888_Config, though this is likely to be
- * relaxed in the future. The meaning of config kARGB_8888_Config is
- * modified by the enum param config8888. The default value interprets
- * kARGB_8888_Config as SkPMColor
- *
- * If the bitmap has pixels already allocated, the canvas pixels will be
- * written there. If not, bitmap->allocPixels() will be called
- * automatically. If the bitmap is backed by a texture readPixels will
- * fail.
- *
- * The actual pixels written is the intersection of the canvas' bounds, and
- * the rectangle formed by the bitmap's width,height and the specified x,y.
- * If bitmap pixels extend outside of that intersection, they will not be
- * modified.
- *
- * Other failure conditions:
- * * If the canvas is backed by a non-raster device (e.g. PDF) then
- * readPixels will fail.
- * * If bitmap is texture-backed then readPixels will fail. (This may be
- * relaxed in the future.)
- *
- * Example that reads the entire canvas into a bitmap using the native
- * SkPMColor:
- * SkISize size = canvas->getDeviceSize();
- * bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
- * size.fHeight);
- * if (canvas->readPixels(bitmap, 0, 0)) {
- * // use the pixels
- * }
- */
- bool readPixels(SkBitmap* bitmap, int x, int y, Config8888 config8888);
-#endif
-
/**
* Copy the pixels from the base-layer into the specified buffer (pixels + rowBytes),
* converting them into the requested format (SkImageInfo). The base-layer pixels are read
@@ -846,7 +761,7 @@ public:
width/height will be the edge color replicated.
If a shader is present on the paint it will be ignored, except in the
- case where the bitmap is kA8_Config. In that case, the color is
+ case where the bitmap is kAlpha_8_SkColorType. In that case, the color is
generated by the shader.
@param bitmap The bitmap to be drawn
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 6b94dd635c..4a39510324 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -287,38 +287,6 @@ protected:
virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
const SkPaint&) = 0;
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- /**
- * On success (returns true), copy the device pixels into the bitmap.
- * On failure, the bitmap parameter is left unchanged and false is
- * returned.
- *
- * The device's pixels are converted to the bitmap's config. The only
- * supported config is kARGB_8888_Config, though this is likely to be
- * relaxed in the future. The meaning of config kARGB_8888_Config is
- * modified by the enum param config8888. The default value interprets
- * kARGB_8888_Config as SkPMColor
- *
- * If the bitmap has pixels already allocated, the device pixels will be
- * written there. If not, bitmap->allocPixels() will be called
- * automatically. If the bitmap is backed by a texture readPixels will
- * fail.
- *
- * The actual pixels written is the intersection of the device's bounds,
- * and the rectangle formed by the bitmap's width,height and the specified
- * x,y. If bitmap pixels extend outside of that intersection, they will not
- * be modified.
- *
- * Other failure conditions:
- * * If the device is not a raster device (e.g. PDF) then readPixels will
- * fail.
- * * If bitmap is texture-backed then readPixels will fail. (This may be
- * relaxed in the future.)
- */
- bool readPixels(SkBitmap* bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888);
-#endif
bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y);
///////////////////////////////////////////////////////////////////////////
@@ -363,12 +331,6 @@ protected:
const SkImageFilter::Context& ctx,
SkBitmap* result, SkIPoint* offset) = 0;
-#ifdef SK_SUPPORT_LEGACY_CONFIG8888
- // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if
- // either is identical to kNative_Premul_Config8888. Otherwise, -1.
- static const SkCanvas::Config8888 kPMColorAlias;
-#endif
-
protected:
// default impl returns NULL
virtual SkSurface* newSurface(const SkImageInfo&);
@@ -377,17 +339,6 @@ protected:
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
/**
- * Implements readPixels API. The caller will ensure that:
- * 1. bitmap has pixel config kARGB_8888_Config.
- * 2. bitmap has pixels.
- * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
- * contained in the device bounds.
- */
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888);
-#endif
-
- /**
* The caller is responsible for "pre-clipping" the dst. The impl can assume that the dst
* image at the specified x,y offset will fit within the device's bounds.
*
diff --git a/include/device/xps/SkXPSDevice.h b/include/device/xps/SkXPSDevice.h
index 690b50ec13..5170957a59 100644
--- a/include/device/xps/SkXPSDevice.h
+++ b/include/device/xps/SkXPSDevice.h
@@ -141,13 +141,6 @@ protected:
int x, int y,
const SkPaint& paint) SK_OVERRIDE;
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- virtual bool onReadPixels(const SkBitmap& bitmap,
- int x,
- int y,
- SkCanvas::Config8888) SK_OVERRIDE;
-#endif
-
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
private:
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index cabbe07dec..9de1e33ea0 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -153,9 +153,6 @@ public:
protected:
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- virtual bool onReadPixels(const SkBitmap&, int x, int y, SkCanvas::Config8888) SK_OVERRIDE;
-#endif
virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) SK_OVERRIDE;
virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVERRIDE;
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index a51684ed65..e250a6de4f 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -208,10 +208,6 @@ public:
}
protected:
-#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
- virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y,
- SkCanvas::Config8888) SK_OVERRIDE;
-#endif
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
private:
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);