aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/SkDashPath.cpp6
-rw-r--r--src/utils/SkDashPathPriv.h18
2 files changed, 18 insertions, 6 deletions
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index 833c7ccce1..8317d20f37 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -216,7 +216,8 @@ private:
bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec,
const SkRect* cullRect, const SkScalar aIntervals[],
int32_t count, SkScalar initialDashLength, int32_t initialDashIndex,
- SkScalar intervalLength) {
+ SkScalar intervalLength,
+ StrokeRecApplication strokeRecApplication) {
// we do nothing if the src wants to be filled
SkStrokeRec::Style style = rec->getStyle();
@@ -235,7 +236,8 @@ bool SkDashPath::InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec
}
SpecialLineRec lineRec;
- bool specialLine = lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLength);
+ bool specialLine = (StrokeRecApplication::kAllow == strokeRecApplication) &&
+ lineRec.init(*srcPtr, dst, rec, count >> 1, intervalLength);
SkPathMeasure meas(*srcPtr, false, rec->getResScale());
diff --git a/src/utils/SkDashPathPriv.h b/src/utils/SkDashPathPriv.h
index 54bf9a4870..115128131f 100644
--- a/src/utils/SkDashPathPriv.h
+++ b/src/utils/SkDashPathPriv.h
@@ -11,7 +11,7 @@
#include "SkPathEffect.h"
namespace SkDashPath {
- /*
+ /**
* Calculates the initialDashLength, initialDashIndex, and intervalLength based on the
* inputed phase and intervals. If adjustedPhase is passed in, then the phase will be
* adjusted to be between 0 and intervalLength. The result will be stored in adjustedPhase.
@@ -26,13 +26,23 @@ namespace SkDashPath {
bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
const SkPathEffect::DashInfo& info);
- /*
- * Caller should have already used ValidDashPath to exclude invalid data.
+ /** See comments for InternalFilter */
+ enum class StrokeRecApplication {
+ kDisallow,
+ kAllow,
+ };
+
+ /**
+ * Caller should have already used ValidDashPath to exclude invalid data. Typically, this leaves
+ * the strokeRec unmodified. However, for some simple shapes (e.g. a line) it may directly
+ * evaluate the dash and stroke to produce a stroked output path with a fill strokeRec. Passing
+ * true for disallowStrokeRecApplication turns this behavior off.
*/
bool InternalFilter(SkPath* dst, const SkPath& src, SkStrokeRec* rec,
const SkRect* cullRect, const SkScalar aIntervals[],
int32_t count, SkScalar initialDashLength, int32_t initialDashIndex,
- SkScalar intervalLength);
+ SkScalar intervalLength,
+ StrokeRecApplication = StrokeRecApplication::kAllow);
bool ValidDashPath(SkScalar phase, const SkScalar intervals[], int32_t count);
}