diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2015-03-06 07:16:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-06 07:16:01 -0800 |
commit | a9d9a392380952006303d83c35a63a32dffd0b36 (patch) | |
tree | 610a08e6b43280fecabdf66d2135c2acfcb6b847 /tests | |
parent | 96e02a8f3f356085073de4a3d897dcc4e0931455 (diff) |
Read pixels in BGRA non-premul mode in few tests
The tests assert on Sk_ColorGREEN, which is in BRGA non-premul. Read the
pixels in same color format.
Currently the tests pass on all platforms because GREEN is fully opaque
and the component stays in the same place both on BGRA and
RGBA. However, hypothetically somebody could copy-paste the assertion
for further tests but use, say, RED. This creates latent error that is
only visible on some platforms like mac.
Review URL: https://codereview.chromium.org/989463002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ImageFilterTest.cpp | 4 | ||||
-rw-r--r-- | tests/SkImageTest.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 2798ea0b18..430481fcc6 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -1010,7 +1010,7 @@ static void test_xfermode_cropped_input(SkBaseDevice* device, skiatest::Reporter canvas.drawSprite(bitmap, 0, 0, &paint); uint32_t pixel; - SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); + SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); canvas.readPixels(info, &pixel, 4, 0, 0); REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); @@ -1059,7 +1059,7 @@ DEF_TEST(ImageFilterNestedSaveLayer, reporter) { strokePaint.setStyle(SkPaint::kStroke_Style); strokePaint.setColor(SK_ColorRED); - SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); + SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); uint32_t pixel; canvas.readPixels(info, &pixel, 4, 25, 25); REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); diff --git a/tests/SkImageTest.cpp b/tests/SkImageTest.cpp index 80ba776af1..3ba63b4258 100644 --- a/tests/SkImageTest.cpp +++ b/tests/SkImageTest.cpp @@ -38,7 +38,7 @@ DEF_TEST(SkImageFromBitmap_extractSubset, reporter) { canvas.drawImage(image, 0, 0, NULL); uint32_t pixel = 0; - SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); + SkImageInfo info = SkImageInfo::Make(1, 1, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType); canvas.readPixels(info, &pixel, 4, 0, 0); REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN); canvas.readPixels(info, &pixel, 4, gWidth - 6, gWidth - 6); |