diff options
author | Hal Canary <halcanary@google.com> | 2018-03-09 16:02:15 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-09 21:32:24 +0000 |
commit | b4e528d7db05daeca7bb050d01e31e718c651de1 (patch) | |
tree | 16fa802ade04b2ddab2da074ebfaa2ff814f5649 /src/pdf/SkPDFDevice.cpp | |
parent | 90432c09ce002cc6db420d8717b193e43770f34a (diff) |
SkPDF: filter out empty clip draws more often
Change-Id: Iff89f95b25ef9c5f57b64affc63bd77c46acd9a6
Reviewed-on: https://skia-review.googlesource.com/113273
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 01bd0a661e..58151ccdd4 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -558,6 +558,9 @@ void SkPDFDevice::drawAnnotation(const SkRect& rect, const char key[], SkData* v } void SkPDFDevice::drawPaint(const SkPaint& srcPaint) { + if (this->hasEmptyClip()) { + return; + } SkPaint newPaint = srcPaint; remove_color_filter(&newPaint); replace_srcmode_on_opaque_paint(&newPaint); @@ -595,6 +598,9 @@ void SkPDFDevice::drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint* points, const SkPaint& srcPaint) { + if (this->hasEmptyClip()) { + return; + } SkPaint passedPaint = srcPaint; remove_color_filter(&passedPaint); replace_srcmode_on_opaque_paint(&passedPaint); @@ -609,9 +615,6 @@ void SkPDFDevice::drawPoints(SkCanvas::PointMode mode, // We only use this when there's a path effect because of the overhead // of multiple calls to setUpContentEntry it causes. if (passedPaint.getPathEffect()) { - if (this->cs().isEmpty(this->bounds())) { - return; - } draw_points(mode, count, points, passedPaint, this->devClipBounds(), this->ctm(), this); return; @@ -719,6 +722,9 @@ static sk_sp<SkPDFDict> create_link_named_dest(const SkData* nameData, void SkPDFDevice::drawRect(const SkRect& rect, const SkPaint& srcPaint) { + if (this->hasEmptyClip()) { + return; + } SkPaint paint = srcPaint; remove_color_filter(&paint); replace_srcmode_on_opaque_paint(&paint); @@ -726,9 +732,6 @@ void SkPDFDevice::drawRect(const SkRect& rect, r.sort(); if (paint.getPathEffect() || paint.getMaskFilter()) { - if (this->cs().isEmpty(this->bounds())) { - return; - } SkPath path; path.addRect(r); this->drawPath(path, paint, nullptr, true); @@ -745,6 +748,9 @@ void SkPDFDevice::drawRect(const SkRect& rect, void SkPDFDevice::drawRRect(const SkRRect& rrect, const SkPaint& srcPaint) { + if (this->hasEmptyClip()) { + return; + } SkPaint paint = srcPaint; remove_color_filter(&paint); replace_srcmode_on_opaque_paint(&paint); @@ -755,6 +761,9 @@ void SkPDFDevice::drawRRect(const SkRRect& rrect, void SkPDFDevice::drawOval(const SkRect& oval, const SkPaint& srcPaint) { + if (this->hasEmptyClip()) { + return; + } SkPaint paint = srcPaint; remove_color_filter(&paint); replace_srcmode_on_opaque_paint(&paint); @@ -849,6 +858,9 @@ void SkPDFDevice::internalDrawPath(const SkClipStack& clipStack, const SkPaint& srcPaint, const SkMatrix* prePathMatrix, bool pathIsMutable) { + if (clipStack.isEmpty(this->bounds())) { + return; + } SkPaint paint = srcPaint; remove_color_filter(&paint); replace_srcmode_on_opaque_paint(&paint); @@ -1348,7 +1360,7 @@ void SkPDFDevice::internalDrawText( if (0 == sourceByteCount || !sourceText || srcPaint.getTextSize() <= 0) { return; } - if (this->cs().isEmpty(this->bounds())) { + if (this->hasEmptyClip()) { return; } NOT_IMPLEMENTED(srcPaint.isVerticalText(), false); @@ -1638,7 +1650,7 @@ void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, } void SkPDFDevice::drawVertices(const SkVertices*, SkBlendMode, const SkPaint&) { - if (this->cs().isEmpty(this->bounds())) { + if (this->hasEmptyClip()) { return; } // TODO: implement drawVertices @@ -1763,7 +1775,7 @@ bool SkPDFDevice::handleInversePath(const SkPath& origPath, return false; } - if (this->cs().isEmpty(this->bounds())) { + if (this->hasEmptyClip()) { return false; } @@ -2242,6 +2254,9 @@ void SkPDFDevice::internalDrawImageRect(SkKeyedImage imageSubset, const SkRect& dst, const SkPaint& srcPaint, const SkMatrix& ctm) { + if (this->hasEmptyClip()) { + return; + } if (!imageSubset) { return; } @@ -2489,6 +2504,9 @@ void SkPDFDevice::internalDrawImageRect(SkKeyedImage imageSubset, void SkPDFDevice::drawSpecial(SkSpecialImage* srcImg, int x, int y, const SkPaint& paint, SkImage* clipImage, const SkMatrix& clipMatrix) { + if (this->hasEmptyClip()) { + return; + } SkASSERT(!srcImg->isTextureBacked()); //TODO: clipImage support |