From 12e946b4bfdf598bffb276776ea6e25439e25265 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 17 Apr 2017 10:53:29 -0400 Subject: deprecate odd variants of SkCanvas::readPixels Bug: skia:6513 Change-Id: I51179a85f0912d3f899c368c30a943d346dd1d05 Reviewed-on: https://skia-review.googlesource.com/13589 Reviewed-by: Florin Malita Reviewed-by: Matt Sarett Commit-Queue: Mike Reed --- tests/ReadPixelsTest.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'tests/ReadPixelsTest.cpp') diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 10462c9140..697d3ee99e 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -247,8 +247,7 @@ static bool check_read(skiatest::Reporter* reporter, enum BitmapInit { kFirstBitmapInit = 0, - kNoPixels_BitmapInit = kFirstBitmapInit, - kTight_BitmapInit, + kTight_BitmapInit = kFirstBitmapInit, kRowBytes_BitmapInit, kRowBytesOdd_BitmapInit, @@ -270,10 +269,7 @@ static void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init, 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 @@ static void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init, 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 @@ static void test_readpixels(skiatest::Reporter* reporter, const sk_sp 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 @@ static void test_readpixels(skiatest::Reporter* reporter, const sk_sp 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 @@ static void test_readpixels(skiatest::Reporter* reporter, const sk_sp } else { REPORTER_ASSERT(reporter, !success); } +#endif } } } -- cgit v1.2.3