diff options
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index c18219ab0d..ced94ce9a9 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -508,8 +508,9 @@ void SkPDFDevice::setFlip() { // natively has the origin at the bottom left. This matrix // corrects for that. But that only needs to be done once, we // don't do it when layering. - fInitialTransform.setTranslate(0, SkIntToScalar(fPageSize.fHeight)); - fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1); + SkScalar rasterScale = SkPDFUtils::kDpiForRasterScaleOne / fDocument->rasterDpi(); + fInitialTransform.setConcat(SkMatrix::MakeScale(rasterScale, -rasterScale), + SkMatrix::MakeTrans(0, -fPageSize.fHeight)); } SkPDFDevice::~SkPDFDevice() { @@ -797,9 +798,6 @@ void SkPDFDevice::internalDrawPathWithFilter(const SkClipStack& clipStack, : SkStrokeRec::kHairline_InitStyle; path.transform(ctm, &path); - // TODO(halcanary): respect fDocument->rasterDpi(). - // SkScalar rasterScale = (float)rasterDpi / SkPDFUtils::kDpiForRasterScaleOne; - // Would it be easier to just change the device size (and pre-scale the canvas)? SkIRect bounds = clipStack.bounds(this->bounds()).roundOut(); SkMask sourceMask; if (!SkDraw::DrawToMask(path, &bounds, paint->getMaskFilter(), &SkMatrix::I(), @@ -2157,7 +2155,6 @@ void SkPDFDevice::internalDrawImageRect(SkKeyedImage imageSubset, // Rasterize the bitmap using perspective in a new bitmap. if (transform.hasPerspective()) { - SkASSERT(fDocument->rasterDpi() > 0); // Transform the bitmap in the new space, without taking into // account the initial transform. SkPath perspectiveOutline; @@ -2173,9 +2170,6 @@ void SkPDFDevice::internalDrawImageRect(SkKeyedImage imageSubset, // account the initial transform. SkMatrix total = transform; total.postConcat(fInitialTransform); - SkScalar dpiScale = SkIntToScalar(fDocument->rasterDpi()) / - SkIntToScalar(SkPDFUtils::kDpiForRasterScaleOne); - total.postScale(dpiScale, dpiScale); SkPath physicalPerspectiveOutline; physicalPerspectiveOutline.addRect(imageBounds); |