aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathEffect.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-24 21:03:11 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-24 21:03:11 +0000
commit4bbdeac58cc928dc66296bde3bd06e78070d96b7 (patch)
tree71033489f3f329bfc8c422c6e04e1df5b734cdb0 /src/core/SkPathEffect.cpp
parent82502e2e3966a9b0e48665f20154eaacd2a452b3 (diff)
add optional cull-rect to patheffects, so they can do less work if their results
lie outside of the current clip-bounds (the cull rect). Review URL: https://codereview.appspot.com/7206044 git-svn-id: http://skia.googlecode.com/svn/trunk@7378 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPathEffect.cpp')
-rw-r--r--src/core/SkPathEffect.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/SkPathEffect.cpp b/src/core/SkPathEffect.cpp
index ebbfd6dc51..38332a4a2f 100644
--- a/src/core/SkPathEffect.cpp
+++ b/src/core/SkPathEffect.cpp
@@ -19,7 +19,7 @@ void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const {
}
bool SkPathEffect::asPoints(PointData* results, const SkPath& src,
- const SkStrokeRec&, const SkMatrix&) const {
+ const SkStrokeRec&, const SkMatrix&, const SkRect*) const {
return false;
}
@@ -56,7 +56,7 @@ SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) {
///////////////////////////////////////////////////////////////////////////////
bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec* rec) const {
+ SkStrokeRec* rec, const SkRect* cullRect) const {
// we may have failed to unflatten these, so we have to check
if (!fPE0 || !fPE1) {
return false;
@@ -65,16 +65,18 @@ bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
SkPath tmp;
const SkPath* ptr = &src;
- if (fPE1->filterPath(&tmp, src, rec)) {
+ if (fPE1->filterPath(&tmp, src, rec, cullRect)) {
ptr = &tmp;
}
- return fPE0->filterPath(dst, *ptr, rec);
+ return fPE0->filterPath(dst, *ptr, rec, cullRect);
}
///////////////////////////////////////////////////////////////////////////////
bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec* rec) const {
+ SkStrokeRec* rec, const SkRect* cullRect) const {
// use bit-or so that we always call both, even if the first one succeeds
- return fPE0->filterPath(dst, src, rec) | fPE1->filterPath(dst, src, rec);
+ return fPE0->filterPath(dst, src, rec, cullRect) |
+ fPE1->filterPath(dst, src, rec, cullRect);
}
+