diff options
author | 2016-12-09 14:51:59 -0500 | |
---|---|---|
committer | 2016-12-09 20:31:23 +0000 | |
commit | 61624f0c716b576706659750d87b6956f4c15722 (patch) | |
tree | 00122b478cf21327b70364fefc5f3f9a6169377e /src/pdf | |
parent | 073285c0595d46205d1482cc19af2d7d891bfeae (diff) |
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 <mtklein@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFBitmap.cpp | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
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<SkPDFObject> SkPDFCreateBitmapObject(sk_sp<SkImage> 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<SkSpecialImage> 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<SkSpecialImage> SkPDFDevice::snapSpecial() { |