aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/readpixels.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-02-14 13:50:43 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-14 21:32:10 +0000
commit9df70bb74db8294283e8d2d8e20c95d290d2a34d (patch)
tree47f70a2a36d254599db76e77cb6c93a31b895b7d /gm/readpixels.cpp
parent6f449692c148c6b36d65c4bfa2941e3b09e25c38 (diff)
Picture backed images must have a bit depth and color space
Enforce that picture backed images created by the public API must have a non-null SkColorSpace. SkPictureShader uses a private call to get around this restriction. BUG=skia: Change-Id: I2fc11a8ffe583035d09e83abf40b827fbf575321 Reviewed-on: https://skia-review.googlesource.com/8415 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'gm/readpixels.cpp')
-rw-r--r--gm/readpixels.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp
index ad9bf8d4f4..f481e268d2 100644
--- a/gm/readpixels.cpp
+++ b/gm/readpixels.cpp
@@ -80,7 +80,7 @@ static void draw_contents(SkCanvas* canvas) {
canvas->drawCircle(60, 60, 35, paint);
}
-static sk_sp<SkImage> make_tagged_picture_image() {
+static sk_sp<SkImage> make_picture_image() {
SkPictureRecorder recorder;
draw_contents(recorder.beginRecording(SkRect::MakeIWH(kWidth, kHeight)));
return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
@@ -89,13 +89,6 @@ static sk_sp<SkImage> make_tagged_picture_image() {
SkColorSpace::MakeSRGB());
}
-static sk_sp<SkImage> make_untagged_picture_image() {
- SkPictureRecorder recorder;
- draw_contents(recorder.beginRecording(SkRect::MakeIWH(kWidth, kHeight)));
- return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
- SkISize::Make(kWidth, kHeight), nullptr, nullptr);
-}
-
static sk_sp<SkColorSpace> make_srgb_transfer_fn(const SkColorSpacePrimaries& primaries) {
SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor);
SkAssertResult(primaries.toXYZD50(&toXYZD50));
@@ -290,8 +283,7 @@ protected:
}
const sk_sp<SkImage> images[] = {
- make_tagged_picture_image(),
- make_untagged_picture_image(),
+ make_picture_image(),
};
const SkAlphaType alphaTypes[] = {
kUnpremul_SkAlphaType,