remove dead code around SK_SUPPORT_LEGACY_CANVAS_READPIXELS
Bug: skia:6513
Change-Id: I8e4e0ffb371ae5b1af972110339e57d491ad9ff1
Reviewed-on: https://skia-review.googlesource.com/13779
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index ddbab07..33a51f7 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -233,22 +233,6 @@
bool readPixels(const SkPixmap&, int srcX, int srcY);
bool readPixels(const SkBitmap&, int srcX, int srcY);
-#ifdef SK_SUPPORT_LEGACY_CANVAS_READPIXELS
- /**
- * Helper for calling readPixels(info, ...). This call will check if bitmap has been allocated.
- * If not, it will attempt to call allocPixels(). If this fails, it will return false. If not,
- * it calls through to readPixels(info, ...) and returns its result.
- */
- bool readPixels(SkBitmap* bitmap, int srcX, int srcY);
- /**
- * Helper for allocating pixels and then calling readPixels(info, ...). The bitmap is resized
- * to the intersection of srcRect and the base-layer bounds. On success, pixels will be
- * allocated in bitmap and true returned. On failure, false is returned and bitmap will be
- * set to empty.
- */
- bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
-#endif
-
/**
* This method affects the pixels in the base-layer, and operates in pixel coordinates,
* ignoring the matrix and clip.
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 844de43..897db3d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -831,49 +831,6 @@
return fMCRec->fTopLayer->fDevice;
}
-#ifdef SK_SUPPORT_LEGACY_CANVAS_READPIXELS
-bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) {
- bool weAllocated = false;
- if (nullptr == bitmap->pixelRef()) {
- if (!bitmap->tryAllocPixels()) {
- return false;
- }
- weAllocated = true;
- }
-
- SkPixmap pm;
- if (bitmap->peekPixels(&pm)) {
- if (this->readPixels(pm.info(), pm.writable_addr(), pm.rowBytes(), x, y)) {
- return true;
- }
- }
-
- if (weAllocated) {
- bitmap->setPixelRef(nullptr, 0, 0);
- }
- return false;
-}
-
-bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
- SkIRect r = srcRect;
- const SkISize size = this->getBaseLayerSize();
- if (!r.intersect(0, 0, size.width(), size.height())) {
- bitmap->reset();
- return false;
- }
-
- if (!bitmap->tryAllocN32Pixels(r.width(), r.height())) {
- // bitmap will already be reset.
- return false;
- }
- if (!this->readPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(), r.x(), r.y())) {
- bitmap->reset();
- return false;
- }
- return true;
-}
-#endif
-
bool SkCanvas::readPixels(const SkImageInfo& dstInfo, void* dstP, size_t rowBytes, int x, int y) {
SkBaseDevice* device = this->getDevice();
if (!device) {
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 89706ac..9cb9200 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -380,23 +380,6 @@
REPORTER_ASSERT(reporter, bmp.isNull());
}
}
-#ifdef SK_SUPPORT_LEGACY_CANVAS_READPIXELS
- // check the old webkit version of readPixels that clips the
- // bitmap size
- SkBitmap wkbmp;
- bool success = canvas->readPixels(srcRect, &wkbmp);
- SkIRect clippedRect = DEV_RECT;
- if (clippedRect.intersect(srcRect)) {
- REPORTER_ASSERT(reporter, success);
- REPORTER_ASSERT(reporter, kN32_SkColorType == wkbmp.colorType());
- REPORTER_ASSERT(reporter, kPremul_SkAlphaType == wkbmp.alphaType());
- check_read(reporter, wkbmp, clippedRect.fLeft,
- clippedRect.fTop, true, false,
- kN32_SkColorType, kPremul_SkAlphaType);
- } else {
- REPORTER_ASSERT(reporter, !success);
- }
-#endif
}
}
}