From c73a1ecbed64652b3d7aa8dc6face9a2205ce830 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 14 Nov 2016 15:09:56 -0500 Subject: Support decoding images to multiple formats, depending on usage Our codec generator will now preserve any asked-for color space, and convert the encoded data to that representation. Cacherator now allows decoding an image to both legacy (nullptr color space), and color-correct formats. In color-correct mode, we choose the best decoded format, based on the original properties, and our backend's capabilities. Preference is given to the native format, when it's already texturable (sRGB 8888 or F16 linear). Otherwise, we prefer linear F16, and fall back to sRGB when that's not an option. BUG=skia:5907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4438 Change-Id: I847c243dcfb72d8c0f1f6fc73c09547adea933f0 Reviewed-on: https://skia-review.googlesource.com/4438 Reviewed-by: Matt Sarett Commit-Queue: Brian Osman --- src/pdf/SkPDFDevice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/pdf/SkPDFDevice.cpp') diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index a04b380005..9a70f68c31 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -2315,8 +2315,12 @@ sk_sp SkPDFDevice::makeSpecial(const SkBitmap& bitmap) { } sk_sp SkPDFDevice::makeSpecial(const SkImage* image) { + // TODO: See comment above in drawSpecial. The color mode we use for decode should be driven + // by the destination where we're going to draw thing thing (ie this device). But we don't have + // a color space, so we always decode in legacy mode for now. return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->height()), - image->makeNonTextureImage()); + image->makeNonTextureImage(), + SkDestinationSurfaceColorMode::kLegacy); } sk_sp SkPDFDevice::snapSpecial() { -- cgit v1.2.3