aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/image_pict.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-12-16 11:55:18 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-16 18:09:02 +0000
commit138ea97c1acaed4b968540220724dd5bf671e8db (patch)
treebd98e545885ec57bf16cc457e10766655b2fec22 /gm/image_pict.cpp
parent8ced688a3a3489ac696e5ee2d10557b389fd4ebf (diff)
Add color space to picture image as a creation parameter
This gives a picture image a preferred "native" color space, which facilitates caching and other things. BUG=skia: Change-Id: I95988c14d17f96d7d870b3d1c3b723c36e2c170d Reviewed-on: https://skia-review.googlesource.com/6158 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'gm/image_pict.cpp')
-rw-r--r--gm/image_pict.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index d2e1ebad95..229f3c5054 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -62,14 +62,15 @@ protected:
// extract enough just for the oval.
const SkISize size = SkISize::Make(100, 100);
+ auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
SkMatrix matrix;
matrix.setTranslate(-100, -100);
- fImage0 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr);
+ fImage0 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr, srgbColorSpace);
matrix.postTranslate(-50, -50);
matrix.postRotate(45);
matrix.postTranslate(50, 50);
- fImage1 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr);
+ fImage1 = SkImage::MakeFromPicture(fPicture, size, &matrix, nullptr, srgbColorSpace);
}
void drawSet(SkCanvas* canvas) const {
@@ -107,7 +108,8 @@ DEF_GM( return new ImagePictGM; )
static SkImageGenerator* make_pic_generator(GrContext*, SkPicture* pic) {
SkMatrix matrix;
matrix.setTranslate(-100, -100);
- return SkImageGenerator::NewFromPicture(SkISize::Make(100, 100), pic, &matrix, nullptr);
+ return SkImageGenerator::NewFromPicture(SkISize::Make(100, 100), pic, &matrix, nullptr,
+ SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
}
class RasterGenerator : public SkImageGenerator {