aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-02-21 13:54:30 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-21 19:35:15 +0000
commitafcd2e1398891546e0c25a5027a9efe01ff4fe71 (patch)
treedd6599e1c7835743b4320b0b658658b1fff0b98f
parentad2a2becb64fff269730d8b9c15f1ba6da1ccdd7 (diff)
initial clean up of pdf clipping
clipstack is always available, canvas checks for empty clips up-front Next step is to clarify if PDF wants to use Regions or Clipstack for its clipping (but not both) Change-Id: Iaf1fa35160291e08c33ff61114557deff72304b3 Reviewed-on: https://skia-review.googlesource.com/8692 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--src/pdf/SkPDFDevice.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index cc85bf4180..2dff42e82e 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -915,15 +915,12 @@ void SkPDFDevice::drawImage(const SkDraw& draw,
SkScalar y,
const SkPaint& srcPaint) {
SkPaint paint = srcPaint;
- if (!image) {
+ if (!image || draw.fRC->isEmpty()) {
return;
}
if (image->isOpaque()) {
replace_srcmode_on_opaque_paint(&paint);
}
- if (draw.fRC->isEmpty()) {
- return;
- }
SkImageSubset imageSubset(sk_ref_sp(const_cast<SkImage*>(image)));
if (!imageSubset.isValid()) {
return;
@@ -1758,23 +1755,6 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli
return nullptr;
}
- // The clip stack can come from an SkDraw where it is technically optional.
- SkClipStack synthesizedClipStack;
- if (clipStack == nullptr) {
- if (clipRegion == fExistingClipRegion) {
- clipStack = &fExistingClipStack;
- } else {
- // GraphicStackState::updateClip expects the clip stack to have
- // fExistingClip as a prefix, so start there, then set the clip
- // to the passed region.
- synthesizedClipStack = fExistingClipStack;
- SkPath clipPath;
- clipRegion.getBoundaryPath(&clipPath);
- synthesizedClipStack.clipPath(clipPath, SkMatrix::I(), kReplace_SkClipOp, false);
- clipStack = &synthesizedClipStack;
- }
- }
-
SkBlendMode blendMode = paint.getBlendMode();
// For the following modes, we want to handle source and destination