aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkCanvas.h16
-rw-r--r--src/core/SkCanvas.cpp43
-rw-r--r--tests/ReadPixelsTest.cpp17
3 files changed, 0 insertions, 76 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index ddbab07480..33a51f7755 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -233,22 +233,6 @@ public:
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 844de43b8a..897db3d45d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -831,49 +831,6 @@ SkBaseDevice* SkCanvas::getTopDevice() const {
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 89706ac5c0..9cb9200f5a 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -380,23 +380,6 @@ static void test_readpixels(skiatest::Reporter* reporter, const sk_sp<SkSurface>
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
}
}
}