aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-07-01 22:17:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-05 21:35:37 +0000
commitb1de5f9f2737159ce055305d87d237be5b0dc010 (patch)
treed6dba8895e76746e19af8ae841c19b3c7cc11ff6 /src/pdf
parent8996e18358752bab9ce0a5da60dbc1af696ce282 (diff)
SkDocument: consolidate trimBox code
Change-Id: I56f651320964eb3bd33475d21e6977803c4ca140 Reviewed-on: https://skia-review.googlesource.com/21370 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFDocument.cpp7
-rw-r--r--src/pdf/SkPDFDocument.h2
2 files changed, 2 insertions, 7 deletions
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 96a79aedb8..ee009651b6 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -193,8 +193,7 @@ void SkPDFDocument::serialize(const sk_sp<SkPDFObject>& object) {
fObjectSerializer.serializeObjects(this->getStream());
}
-SkCanvas* SkPDFDocument::onBeginPage(SkScalar width, SkScalar height,
- const SkRect& trimBox) {
+SkCanvas* SkPDFDocument::onBeginPage(SkScalar width, SkScalar height) {
SkASSERT(!fCanvas.get()); // endPage() was called before this.
if (fPages.empty()) {
// if this is the first page if the document.
@@ -218,10 +217,6 @@ SkCanvas* SkPDFDocument::onBeginPage(SkScalar width, SkScalar height,
fPageDevice = sk_make_sp<SkPDFDevice>(pageSize, this);
fPageDevice->setFlip(); // Only the top-level device needs to be flipped.
fCanvas.reset(new SkPDFCanvas(fPageDevice));
- if (SkRect::MakeWH(width, height) != trimBox) {
- fCanvas->clipRect(trimBox);
- fCanvas->translate(trimBox.x(), trimBox.y());
- }
return fCanvas.get();
}
diff --git a/src/pdf/SkPDFDocument.h b/src/pdf/SkPDFDocument.h
index 7f8b6c84a3..3e3a50ae83 100644
--- a/src/pdf/SkPDFDocument.h
+++ b/src/pdf/SkPDFDocument.h
@@ -61,7 +61,7 @@ public:
sk_sp<SkPixelSerializer>,
bool);
~SkPDFDocument() override;
- SkCanvas* onBeginPage(SkScalar, SkScalar, const SkRect&) override;
+ SkCanvas* onBeginPage(SkScalar, SkScalar) override;
void onEndPage() override;
void onClose(SkWStream*) override;
void onAbort() override;