diff options
author | 2013-10-14 13:42:12 +0000 | |
---|---|---|
committer | 2013-10-14 13:42:12 +0000 | |
commit | 5e00989a283111cef05bed8102e45c16651e43e4 (patch) | |
tree | f392a48807724566537fd8d128f00ce175f1417c /src/doc/SkDocument_PDF.cpp | |
parent | 1108fc3058e64a9363f7ea4ef41e2b04ca51f539 (diff) |
Add SkPDFDeviceFlatenner which extends SkPDFDevice to add support to flatten the path and the text when we have perspective.
prepare to deprecate SkPDFDevice constructor, and route gm and render_pdfs to use SkDocument::Create pdf interface instead. - controlled by a flag
add comments where we are supposed to flatten other features (paint, shaders, ... )
R=reed@google.com, bungeman@google.com, scroggo@google.com, vandebo@chromium.org, bsalomon@google.com
Author: edisonn@google.com
Review URL: https://codereview.chromium.org/24811002
git-svn-id: http://skia.googlecode.com/svn/trunk@11751 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/doc/SkDocument_PDF.cpp')
-rw-r--r-- | src/doc/SkDocument_PDF.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp index b9b55f8dce..695929f32f 100644 --- a/src/doc/SkDocument_PDF.cpp +++ b/src/doc/SkDocument_PDF.cpp @@ -6,8 +6,8 @@ */ #include "SkDocument.h" -#include "SkPDFDevice.h" #include "SkPDFDocument.h" +#include "SkPDFDeviceFlattener.h" class SkDocument_PDF : public SkDocument { public: @@ -27,19 +27,14 @@ public: protected: virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, - const SkRect& content) SK_OVERRIDE { + const SkRect& trimBox) SK_OVERRIDE { SkASSERT(NULL == fCanvas); SkASSERT(NULL == fDevice); - SkISize pageS, contentS; - SkMatrix matrix; + SkSize mediaBoxSize; + mediaBoxSize.set(width, height); - pageS.set(SkScalarRoundToInt(width), SkScalarRoundToInt(height)); - contentS.set(SkScalarRoundToInt(content.width()), - SkScalarRoundToInt(content.height())); - matrix.setTranslate(content.fLeft, content.fTop); - - fDevice = SkNEW_ARGS(SkPDFDevice, (pageS, contentS, matrix)); + fDevice = SkNEW_ARGS(SkPDFDeviceFlattener, (mediaBoxSize, &trimBox)); if (fEncoder) { fDevice->setDCTEncoder(fEncoder); } @@ -78,7 +73,7 @@ protected: private: SkPDFDocument* fDoc; - SkPDFDevice* fDevice; + SkPDFDeviceFlattener* fDevice; SkCanvas* fCanvas; SkPicture::EncodeBitmap fEncoder; }; |