Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1116)

Unified Diff: tests/ImageTest.cpp

Issue 2250663002: Add alphaType() to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@special-image-alpha-type
Patch Set: Remove virtuals from SkImage, slight cleanup Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index ca4788c4491f9c557355aea5e3a7aff4c41e7447..fa22641d9e222ebe5765146f143f9e7ddafdfaba 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -43,8 +43,7 @@ static void assert_equal(skiatest::Reporter* reporter, SkImage* a, const SkIRect
// see https://bug.skia.org/3965
//REPORTER_ASSERT(reporter, a->isOpaque() == b->isOpaque());
- SkImageInfo info = SkImageInfo::MakeN32(widthA, heightA,
- a->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
+ SkImageInfo info = SkImageInfo::MakeN32(widthA, heightA, a->alphaType());
SkAutoPixmapStorage pmapA, pmapB;
pmapA.alloc(info);
pmapB.alloc(info);
@@ -505,8 +504,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInf
if (image->width() != texImage->width() || image->height() != texImage->height()) {
ERRORF(reporter, "newTextureImage changed the image size.");
}
- if (image->isOpaque() != texImage->isOpaque()) {
- ERRORF(reporter, "newTextureImage changed image opaqueness.");
+ if (image->alphaType() != texImage->alphaType()) {
+ ERRORF(reporter, "newTextureImage changed image alpha type.");
}
}
}
@@ -669,7 +668,7 @@ static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima
const SkBitmap& bitmap, SkImage::LegacyBitmapMode mode) {
REPORTER_ASSERT(reporter, image->width() == bitmap.width());
REPORTER_ASSERT(reporter, image->height() == bitmap.height());
- REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque());
+ REPORTER_ASSERT(reporter, image->alphaType() == bitmap.alphaType());
if (SkImage::kRO_LegacyBitmapMode == mode) {
REPORTER_ASSERT(reporter, bitmap.isImmutable());
@@ -812,8 +811,8 @@ static void check_images_same(skiatest::Reporter* reporter, const SkImage* a, co
ERRORF(reporter, "Images must have the same size");
return;
}
- if (a->isOpaque() != b->isOpaque()) {
- ERRORF(reporter, "Images must have the same opaquness");
+ if (a->alphaType() != b->alphaType()) {
+ ERRORF(reporter, "Images must have the same alpha type");
return;
}
@@ -948,9 +947,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
if (newImage) {
// Scale the image in software for comparison.
SkImageInfo scaled_info = SkImageInfo::MakeN32(
- image->width() / testCase.fExpectedScaleFactor,
- image->height() / testCase.fExpectedScaleFactor,
- image->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
+ image->width() / testCase.fExpectedScaleFactor,
+ image->height() / testCase.fExpectedScaleFactor,
+ image->alphaType());
SkAutoPixmapStorage scaled;
scaled.alloc(scaled_info);
image->scalePixels(scaled, testCase.fExpectedQuality);
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698