deprecate odd variants of SkCanvas::readPixels
Bug: skia:6513
Change-Id: I51179a85f0912d3f899c368c30a943d346dd1d05
Reviewed-on: https://skia-review.googlesource.com/13589
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 10462c9..697d3ee 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -247,8 +247,7 @@
enum BitmapInit {
kFirstBitmapInit = 0,
- kNoPixels_BitmapInit = kFirstBitmapInit,
- kTight_BitmapInit,
+ kTight_BitmapInit = kFirstBitmapInit,
kRowBytes_BitmapInit,
kRowBytesOdd_BitmapInit,
@@ -270,10 +269,7 @@
SkAlphaType at) {
SkImageInfo info = SkImageInfo::Make(rect.width(), rect.height(), ct, at);
size_t rowBytes = 0;
- bool alloc = true;
switch (init) {
- case kNoPixels_BitmapInit:
- alloc = false;
case kTight_BitmapInit:
break;
case kRowBytes_BitmapInit:
@@ -286,12 +282,7 @@
SkASSERT(0);
break;
}
-
- if (alloc) {
- bitmap->allocPixels(info, rowBytes);
- } else {
- bitmap->setInfo(info, rowBytes);
- }
+ bitmap->allocPixels(info, rowBytes);
}
static const struct {
@@ -370,7 +361,7 @@
fill_dst_bmp_with_init_data(&bmp);
}
uint32_t idBefore = surface->generationID();
- bool success = canvas->readPixels(&bmp, srcRect.fLeft, srcRect.fTop);
+ bool success = canvas->readPixels(bmp, srcRect.fLeft, srcRect.fTop);
uint32_t idAfter = surface->generationID();
// we expect to succeed when the read isn't fully clipped
@@ -391,6 +382,7 @@
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;
@@ -406,6 +398,7 @@
} else {
REPORTER_ASSERT(reporter, !success);
}
+#endif
}
}
}