diff options
author | Hal Canary <halcanary@google.com> | 2017-06-29 18:51:35 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-30 15:37:45 +0000 |
commit | a062258e76e28ef0ec88ef827ae84a90730393cc (patch) | |
tree | 1806f06e43425696b2fad918dd7c4e7fd10d508b /src/pdf/SkPDFDevice.h | |
parent | 1c9686bfa5e2de3e06f1d1b9691105afb6659e85 (diff) |
SkPDF: clean up fRasterDpi
- PDFDevice no longer has a fRasterDpi; simply queries document.
- #define DPI_FOR_RASTER_SCALE_ONE becomes constexpr float.
- PDFShader::GetPDFShader no longer takes rasterScale or dpi
- Remove un-needed factory functions. We're all adults here.
Change-Id: Id2ce75d4e61af385763ccfb1db210465a1600067
Reviewed-on: https://skia-review.googlesource.com/21348
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf/SkPDFDevice.h')
-rw-r--r-- | src/pdf/SkPDFDevice.h | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h index ad44bcd12d..8d2c511be0 100644 --- a/src/pdf/SkPDFDevice.h +++ b/src/pdf/SkPDFDevice.h @@ -33,53 +33,42 @@ class SkPDFObject; class SkPDFStream; class SkRRect; -/** \class SkPDFDevice - - The drawing context for the PDF backend. -*/ +/** + * \class SkPDFDevice + * + * An SkPDFDevice is the drawing context for a page or layer of PDF + * content. + */ class SkPDFDevice final : public SkClipStackDevice { public: - /** Create a PDF drawing context. SkPDFDevice applies a - * scale-and-translate transform to move the origin from the - * bottom left (PDF default) to the top left (Skia default). + /** * @param pageSize Page size in point units. * 1 point == 127/360 mm == 1/72 inch - * @param rasterDpi the DPI at which features without native PDF - * support will be rasterized (e.g. draw image with - * perspective, draw text with perspective, ...). A - * larger DPI would create a PDF that reflects the - * original intent with better fidelity, but it can make - * for larger PDF files too, which would use more memory - * while rendering, and it would be slower to be processed - * or sent online or to printer. A good choice is - * SK_ScalarDefaultRasterDPI(72.0f). - * @param SkPDFDocument. A non-null pointer back to the - * document. The document is repsonsible for + * @param document A non-null pointer back to the + * PDFDocument object. The document is repsonsible for * de-duplicating across pages (via the SkPDFCanon) and * for early serializing of large immutable objects, such * as images (via SkPDFDocument::serialize()). */ - static sk_sp<SkPDFDevice> Make(SkISize pageSize, SkScalar rasterDpi, SkPDFDocument* doc) { - return sk_sp<SkPDFDevice>(new SkPDFDevice(pageSize, rasterDpi, doc, true)); - } + SkPDFDevice(SkISize pageSize, SkPDFDocument* document); - /** Create a PDF drawing context without fipping the y-axis. */ - static sk_sp<SkPDFDevice> MakeUnflipped(SkISize pageSize, - SkScalar rasterDpi, - SkPDFDocument* doc) { - return sk_sp<SkPDFDevice>(new SkPDFDevice(pageSize, rasterDpi, doc, false)); - } + /** + * Apply a scale-and-translate transform to move the origin from the + * bottom left (PDF default) to the top left (Skia default). + */ + void setFlip(); sk_sp<SkPDFDevice> makeCongruentDevice() { - return sk_sp<SkPDFDevice>(new SkPDFDevice(fPageSize, fRasterDpi, fDocument, false)); + return sk_make_sp<SkPDFDevice>(fPageSize, fDocument); } ~SkPDFDevice() override; - /** These are called inside the per-device-layer loop for each draw call. - When these are called, we have already applied any saveLayer operations, - and are handling any looping from the paint, and any effects from the - DrawFilter. + /** + * These are called inside the per-device-layer loop for each draw call. + * When these are called, we have already applied any saveLayer + * operations, and are handling any looping from the paint, and any + * effects from the DrawFilter. */ void drawPaint(const SkPaint& paint) override; void drawPoints(SkCanvas::PointMode mode, @@ -212,15 +201,9 @@ private: }; SkSinglyLinkedList<ContentEntry> fContentEntries; - SkScalar fRasterDpi; - SkPDFDocument* fDocument; - //////////////////////////////////////////////////////////////////////////// - SkPDFDevice(SkISize pageSize, - SkScalar rasterDpi, - SkPDFDocument* doc, - bool flip); + //////////////////////////////////////////////////////////////////////////// SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; |