aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDevice.cpp
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-07-26 09:16:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-26 16:13:29 +0000
commitb4bd5ef99c99745959a9f1eb208d558da163d8d8 (patch)
treee15f2083b2a807386c6cac1465f08d8c11dda7c9 /src/pdf/SkPDFDevice.cpp
parentd902042c7324d2d648ceedb242f96f4fdb8d04eb (diff)
SkPDF: Use DeviceGray for alpha masks.
See https://groups.google.com/forum/#!topic/pdf-dev/qmdjg3w7D8E BUG=chromium:742058 Change-Id: Ia8c204a92cb2b9fc33fab60826a95e359db65f08 Reviewed-on: https://skia-review.googlesource.com/26822 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r--src/pdf/SkPDFDevice.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index e4ab92850a..57a0f7df61 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -869,7 +869,7 @@ void SkPDFDevice::internalDrawPathWithFilter(const SkClipStack& clipStack,
void SkPDFDevice::addSMaskGraphicState(sk_sp<SkPDFDevice> maskDevice,
SkDynamicMemoryWStream* contentStream) {
sk_sp<SkPDFDict> sMaskGS = SkPDFGraphicState::GetSMaskGraphicState(
- maskDevice->makeFormXObjectFromDevice(), false,
+ maskDevice->makeFormXObjectFromDevice(true), false,
SkPDFGraphicState::kLuminosity_SMaskMode, this->getCanon());
SkPDFUtils::ApplyGraphicState(this->addGraphicStateResource(sMaskGS.get()), contentStream);
}
@@ -1885,7 +1885,7 @@ void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) const {
}
}
-sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice() {
+sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice(bool alpha) {
SkMatrix inverseTransform = SkMatrix::I();
if (!fInitialTransform.isIdentity()) {
if (!fInitialTransform.invert(&inverseTransform)) {
@@ -1893,9 +1893,10 @@ sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice() {
inverseTransform.reset();
}
}
+ const char* colorSpace = alpha ? "DeviceGray" : nullptr;
sk_sp<SkPDFObject> xobject =
SkPDFMakeFormXObject(this->content(), this->copyMediaBox(),
- this->makeResourceDict(), inverseTransform, nullptr);
+ this->makeResourceDict(), inverseTransform, colorSpace);
// We always draw the form xobjects that we create back into the device, so
// we simply preserve the font usage instead of pulling it out and merging
// it back in later.