aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkImageTest.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-03-06 07:16:00 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-06 07:16:01 -0800
commita9d9a392380952006303d83c35a63a32dffd0b36 (patch)
tree610a08e6b43280fecabdf66d2135c2acfcb6b847 /tests/SkImageTest.cpp
parent96e02a8f3f356085073de4a3d897dcc4e0931455 (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/SkImageTest.cpp')
-rw-r--r--tests/SkImageTest.cpp2
1 files changed, 1 insertions, 1 deletions
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);