From cb6266b5aa5bbfd880532f08eec83b0c585e873f Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Tue, 17 Jan 2017 10:48:53 -0500 Subject: Reland "Add SkImageInfoValidConversion() and SkImageInfoIsValid" The original is at: https://skia-review.googlesource.com/c/6887/ The only change to the original is to temporarily comment out a check in SkImageInfoPriv.h until a Chrome unit test can be fixed. The idea is share these standards for the following: SkImage::readPixels() SkCanvas::readPixels() SkCanvas::writePixels() SkBitmap::readPixels() SkPixmap::readPixels() On the raster side, SkPixmap::readPixels() is the right place to check, because all raster calls go through there eventually. Then at lower levels (ex: SkPixelInfo), we can assert. There's not really a unifying location for gpu calls, so I've added this in multiple places. I haven't really dug into the gpu code to SkASSERT() on invalid cases that we will have already caught. Follow-up work: Similar refactor for SkReadPixelRec::trim(). Code cleanup in SkPixelInfo::CopyPixels() BUG=skia:6021 Change-Id: I6a16f9479bc09e3c87e10c72b0378579f1a70866 Reviewed-on: https://skia-review.googlesource.com/7104 Reviewed-by: Matt Sarett Commit-Queue: Matt Sarett --- tests/SpecialImageTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/SpecialImageTest.cpp') diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index b0915f073f..33f394811a 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -88,7 +88,7 @@ static void test_image(const sk_sp& img, skiatest::Reporter* rep // Test that draw restricts itself to the subset SkImageFilter::OutputProperties outProps(img->getColorSpace()); sk_sp surf(img->makeSurface(outProps, SkISize::Make(kFullSize, kFullSize), - kOpaque_SkAlphaType)); + kPremul_SkAlphaType)); SkCanvas* canvas = surf->getCanvas(); @@ -96,7 +96,7 @@ static void test_image(const sk_sp& img, skiatest::Reporter* rep img->draw(canvas, SkIntToScalar(kPad), SkIntToScalar(kPad), nullptr); SkBitmap bm; - bm.allocN32Pixels(kFullSize, kFullSize, true); + bm.allocN32Pixels(kFullSize, kFullSize, false); bool result = canvas->readPixels(bm.info(), bm.getPixels(), bm.rowBytes(), 0, 0); SkASSERT_RELEASE(result); -- cgit v1.2.3