aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
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/core
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/core')
-rw-r--r--src/core/SkDocument.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/SkDocument.cpp b/src/core/SkDocument.cpp
index 29db7f05e1..006be91439 100644
--- a/src/core/SkDocument.cpp
+++ b/src/core/SkDocument.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkCanvas.h"
#include "SkDocument.h"
#include "SkStream.h"
@@ -37,9 +38,15 @@ SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height,
for (;;) {
switch (fState) {
- case kBetweenPages_State:
+ case kBetweenPages_State: {
fState = kInPage_State;
- return this->onBeginPage(width, height, inner);
+ SkCanvas* canvas = this->onBeginPage(width, height);
+ if (content) {
+ canvas->clipRect(inner);
+ canvas->translate(inner.x(), inner.y());
+ }
+ return canvas;
+ }
case kInPage_State:
this->endPage();
break;