Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: src/gpu/GrStrokeInfo.cpp

Issue 1381803005: Fix gpu dashing for case where all intervals are 0. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: spelling Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/dashing.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStrokeInfo.cpp
diff --git a/src/gpu/GrStrokeInfo.cpp b/src/gpu/GrStrokeInfo.cpp
index f3c809d46b77b2357c44c02cb30a3ccf61cef153..3b8ecb660bd08a77ae4fafd4bf06ed124d91f12f 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;
« no previous file with comments | « gm/dashing.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698