aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/pdf/SkPDFDevice.cpp7
-rw-r--r--src/pdf/SkPDFDevice.h3
2 files changed, 6 insertions, 4 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.
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 51a9b10d94..b9ee881523 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -212,7 +212,8 @@ private:
void init();
void cleanUp();
- sk_sp<SkPDFObject> makeFormXObjectFromDevice();
+ // Set alpha to true if making a transparency group form x-objects.
+ sk_sp<SkPDFObject> makeFormXObjectFromDevice(bool alpha = false);
void drawFormXObjectWithMask(int xObjectIndex,
sk_sp<SkPDFObject> mask,