aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-25 01:04:12 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-25 01:04:12 +0000
commitfd4be26c4202ae91f0f7cf2c03e44b5169d885eb (patch)
tree9db06c859711d7433330c378b5d552454e7e0438 /src/effects
parentd3521f1a8dc07fe84d6a8f2151b0c176ff1ec8ca (diff)
Change patheffect to take a (new) StrokeRec object, which encapsulates the fill
or stroke parameters for a path. Today, the patheffect only sees if the caller was going to stroke or fill, and if stroke, it just sees the width. With this change, the effect can see all of the related parameters (e.g. cap/join/miter). No other change is intended at this time. After this change, I hope to use this additional data to allow SkDashPathEffect to, at times, apply the stroke as part of its effect, which may be much more efficient than first dashing, and then reading that and stroking it. Most of these files changed just because of the new parameter to filterPath. The key changes are in SkPathEffect.[h,cpp], SkPaint.cpp and SkScalerContext.cpp Review URL: https://codereview.appspot.com/6250051 git-svn-id: http://skia.googlecode.com/svn/trunk@4048 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/Sk1DPathEffect.cpp8
-rw-r--r--src/effects/Sk2DPathEffect.cpp2
-rw-r--r--src/effects/SkCornerPathEffect.cpp2
-rw-r--r--src/effects/SkDashPathEffect.cpp4
-rw-r--r--src/effects/SkDiscretePathEffect.cpp4
5 files changed, 10 insertions, 10 deletions
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 09e8d135b6..10a9a8434b 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -10,7 +10,7 @@
#include "Sk1DPathEffect.h"
#include "SkPathMeasure.h"
-bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width) {
+bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
SkPathMeasure meas(src, false);
do {
SkScalar length = meas.getLength();
@@ -67,10 +67,10 @@ SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance,
}
bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkScalar* width) {
+ SkStrokeRec* rec) {
if (fAdvance > 0) {
- *width = -1;
- return this->INHERITED::filterPath(dst, src, width);
+ rec->setFillStyle();
+ return this->INHERITED::filterPath(dst, src, rec);
}
return false;
}
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 8693157f16..3f8c998651 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -31,7 +31,7 @@ Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
fMatrixIsInvertible = mat.invert(&fInverse);
}
-bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkScalar* width) {
+bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
if (!fMatrixIsInvertible) {
return false;
}
diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp
index 474623175b..749384d579 100644
--- a/src/effects/SkCornerPathEffect.cpp
+++ b/src/effects/SkCornerPathEffect.cpp
@@ -36,7 +36,7 @@ static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
}
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkScalar* width) {
+ SkStrokeRec*) {
if (fRadius == 0) {
return false;
}
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 0cc97b6b15..13c19afab4 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -81,9 +81,9 @@ SkDashPathEffect::~SkDashPathEffect() {
}
bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkScalar* width) {
+ SkStrokeRec* rec) {
// we do nothing if the src wants to be filled, or if our dashlength is 0
- if (*width < 0 || fInitialDashLength < 0) {
+ if (rec->isFillStyle() || fInitialDashLength < 0) {
return false;
}
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index 06b9d19c68..0536e5646d 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -26,8 +26,8 @@ SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, SkScalar deviatio
}
bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkScalar* width) {
- bool doFill = *width < 0;
+ SkStrokeRec* rec) {
+ bool doFill = rec->isFillStyle();
SkPathMeasure meas(src, doFill);
uint32_t seed = SkScalarRound(meas.getLength());