Broken in https://skia.googlesource.com/skia/+/4b1e17e
BUG=632574
TBR=tomhudson@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=
2197623002
Review-Url: https://codereview.chromium.org/
2197623002
}
sk_sp<SkPDFObject> SkPDFDevice::makeFormXObjectFromDevice() {
+ SkMatrix inverseTransform = SkMatrix::I();
+ if (!this->initialTransform().isIdentity()) {
+ if (!this->initialTransform().invert(&inverseTransform)) {
+ SkDEBUGFAIL("Layer initial transform should be invertible.");
+ inverseTransform.reset();
+ }
+ }
sk_sp<SkPDFObject> xobject =
SkPDFMakeFormXObject(this->content(), this->copyMediaBox(),
- this->makeResourceDict(), nullptr);
+ this->makeResourceDict(), inverseTransform, nullptr);
// 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.
#include "SkPDFFormXObject.h"
+#include "SkPDFUtils.h"
sk_sp<SkPDFObject> SkPDFMakeFormXObject(std::unique_ptr<SkStreamAsset> content,
sk_sp<SkPDFArray> mediaBox,
sk_sp<SkPDFDict> resourceDict,
+ const SkMatrix& inverseTransform,
const char* colorSpace) {
auto form = sk_make_sp<SkPDFStream>(std::move(content));
form->insertName("Type", "XObject");
form->insertName("Subtype", "Form");
+ if (!inverseTransform.isIdentity()) {
+ form->insertObject("Matrix",
+ SkPDFUtils::MatrixToArray(inverseTransform));
+ }
form->insertObject("Resources", std::move(resourceDict));
form->insertObject("BBox", std::move(mediaBox));
sk_sp<SkPDFObject> SkPDFMakeFormXObject(std::unique_ptr<SkStreamAsset> content,
sk_sp<SkPDFArray> mediaBox,
sk_sp<SkPDFDict> resourceDict,
+ const SkMatrix& inverseTransform,
const char* colorSpace);
#endif
auto alphaMask = SkPDFMakeFormXObject(std::move(alphaStream),
SkPDFUtils::RectToArray(bbox),
std::move(resources),
+ SkMatrix::I(),
"DeviceRGB");
return SkPDFGraphicState::GetSMaskGraphicState(
alphaMask.get(), false,