diff options
author | egdaniel <egdaniel@google.com> | 2015-10-05 08:11:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-05 08:11:49 -0700 |
commit | c00389e45a54e699ac20ff77a81e9de54c4e6ea4 (patch) | |
tree | 99f0e9a9000f5cc8dc8ff496e9f4a9d2fc1bf410 /src/gpu/GrStrokeInfo.cpp | |
parent | 6f6264fbbc15d4184c81ca94949f2d4f3efdc2c8 (diff) |
Fix gpu dashing for case where all intervals are 0.
BUG=skia:4409
Review URL: https://codereview.chromium.org/1381803005
Diffstat (limited to 'src/gpu/GrStrokeInfo.cpp')
-rw-r--r-- | src/gpu/GrStrokeInfo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gpu/GrStrokeInfo.cpp b/src/gpu/GrStrokeInfo.cpp index f3c809d46b..3b8ecb660b 100644 --- a/src/gpu/GrStrokeInfo.cpp +++ b/src/gpu/GrStrokeInfo.cpp @@ -9,6 +9,15 @@ #include "GrResourceKey.h" #include "SkDashPathPriv.h" +bool all_dash_intervals_zero(const SkScalar* intervals, int count) { + for (int i = 0 ; i < count; ++i) { + if (intervals[i] != 0) { + return false; + } + } + return true; +} + bool GrStrokeInfo::applyDashToPath(SkPath* dst, GrStrokeInfo* dstStrokeInfo, const SkPath& src) const { if (this->isDashed()) { @@ -17,6 +26,13 @@ bool GrStrokeInfo::applyDashToPath(SkPath* dst, GrStrokeInfo* dstStrokeInfo, info.fCount = fIntervals.count(); info.fPhase = fDashPhase; GrStrokeInfo filteredStroke(*this, false); + // Handle the case where all intervals are 0 and we simply drop the dash effect + if (all_dash_intervals_zero(fIntervals.get(), fIntervals.count())) { + *dstStrokeInfo = filteredStroke; + *dst = src; + return true; + } + // See if we can filter the dash into a path on cpu if (SkDashPath::FilterDashPath(dst, src, &filteredStroke, nullptr, info)) { *dstStrokeInfo = filteredStroke; return true; |