aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ImageGeneratorTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-06-20 09:35:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-20 14:03:01 +0000
commite53120754b358e950ff417d864f80004697b5a91 (patch)
tree5da230f1cc3b404bb9aea0098095d6d0e7924595 /tests/ImageGeneratorTest.cpp
parent151b6ff29593093e409f7f4f24129a6f7fde2467 (diff)
Add SkCopyPixelsMode argument to SkMakeImageInColorSpace
Deferred rendering in Android will need the ability to use this in kIfMutable mode. Bug: skia: Change-Id: I5194f2c50f9d17351fdab49373ca9bc1e80cf586 Reviewed-on: https://skia-review.googlesource.com/20157 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'tests/ImageGeneratorTest.cpp')
-rw-r--r--tests/ImageGeneratorTest.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/ImageGeneratorTest.cpp b/tests/ImageGeneratorTest.cpp
index bc9dca4b18..5cfd410ad0 100644
--- a/tests/ImageGeneratorTest.cpp
+++ b/tests/ImageGeneratorTest.cpp
@@ -113,7 +113,7 @@ DEF_TEST(PictureImageGenerator, reporter) {
#include "SkImagePriv.h"
DEF_TEST(ColorXformGenerator, r) {
- SkBitmap a, b, c, d;
+ SkBitmap a, b, c, d, e;
SkImageInfo info = SkImageInfo::MakeS32(1, 1, kPremul_SkAlphaType);
a.allocPixels(info);
b.allocPixels(info.makeColorSpace(nullptr));
@@ -121,16 +121,20 @@ DEF_TEST(ColorXformGenerator, r) {
SkColorSpace::kRec2020_Gamut)));
d.allocPixels(info.makeColorSpace(SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
SkColorSpace::kAdobeRGB_Gamut)));
+ e.allocPixels(info);
a.eraseColor(0);
b.eraseColor(1);
c.eraseColor(2);
d.eraseColor(3);
+ e.eraseColor(4);
sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
sk_sp<SkImage> ia = SkMakeImageInColorSpace(a, srgb, 0);
sk_sp<SkImage> ib = SkMakeImageInColorSpace(b, srgb, b.getGenerationID());
sk_sp<SkImage> ic = SkMakeImageInColorSpace(c, srgb, c.getGenerationID());
sk_sp<SkImage> id = SkMakeImageInColorSpace(d, srgb, 0);
+ sk_sp<SkImage> ie = SkMakeImageInColorSpace(e, srgb, e.getGenerationID(),
+ kAlways_SkCopyPixelsMode);
// Equal because sRGB->sRGB is a no-op.
REPORTER_ASSERT(r, ia->uniqueID() == a.getGenerationID());
@@ -145,4 +149,7 @@ DEF_TEST(ColorXformGenerator, r) {
// Not equal because sRGB->Adobe is not a no-op and we do not pass an explicit id.
REPORTER_ASSERT(r, id->uniqueID() != d.getGenerationID());
+
+ // Equal because we pass in an explicit id. Forcing a copy, but still want the id respected.
+ REPORTER_ASSERT(r, ie->uniqueID() == e.getGenerationID());
}