From 61624f0c716b576706659750d87b6956f4c15722 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Fri, 9 Dec 2016 14:51:59 -0500 Subject: Plumb dst color space in many places, rather than "mode" This is less to type in most cases, and gives us more information (for things like picture-backed images, where we need to know all about the destination surface). Additionally, strip out the plumbing entirely for bitmap sources, where we don't need to know anything. BUG=skia: Change-Id: I4deff6c7c345fcf62eb08b2aff0560adae4313da Reviewed-on: https://skia-review.googlesource.com/5748 Reviewed-by: Mike Klein Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- src/pdf/SkPDFBitmap.cpp | 6 ++++-- src/pdf/SkPDFDevice.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/pdf') diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp index ea6887ac80..511fca8370 100644 --- a/src/pdf/SkPDFBitmap.cpp +++ b/src/pdf/SkPDFBitmap.cpp @@ -17,7 +17,8 @@ #include "SkUnPreMultiply.h" void image_get_ro_pixels(const SkImage* image, SkBitmap* dst) { - if(as_IB(image)->getROPixels(dst, SkDestinationSurfaceColorMode::kLegacy) + SkColorSpace* legacyColorSpace = nullptr; + if(as_IB(image)->getROPixels(dst, legacyColorSpace) && dst->dimensions() == image->dimensions()) { if (dst->colorType() != kIndex_8_SkColorType) { return; @@ -502,7 +503,8 @@ sk_sp SkPDFCreateBitmapObject(sk_sp image, if (pixelSerializer) { SkBitmap bm; SkAutoPixmapUnlock apu; - if (as_IB(image.get())->getROPixels(&bm, SkDestinationSurfaceColorMode::kLegacy) && + SkColorSpace* legacyColorSpace = nullptr; + if (as_IB(image.get())->getROPixels(&bm, legacyColorSpace) && bm.requestLock(&apu)) { data.reset(pixelSerializer->encode(apu.pixmap())); if (data && SkIsJFIF(data.get(), &info)) { diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 7d7196bfe8..5724b1af6e 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -2318,9 +2318,9 @@ 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. + SkColorSpace* legacyColorSpace = nullptr; return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->height()), - image->makeNonTextureImage(), - SkDestinationSurfaceColorMode::kLegacy); + image->makeNonTextureImage(), legacyColorSpace); } sk_sp SkPDFDevice::snapSpecial() { -- cgit v1.2.3