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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp

Issue 1381973002: Disable canvas line dashing when dash sequence is all zeros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
index 94b6d969cc35ec778d0894bd298375ebb4331097..6e75481849f09163c196e8f1f4d46dd3bcb383c3 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
@@ -199,12 +199,21 @@ void CanvasRenderingContext2DState::setLineDash(const Vector<float>& dash)
m_lineDashDirty = true;
}
+static bool hasANonZeroElement(const Vector<float>& lineDash)
+{
+ for (size_t i = 0; i < lineDash.size(); i++) {
+ if (lineDash[i] != 0.0f)
+ return true;
+ }
+ return false;
+}
+
void CanvasRenderingContext2DState::updateLineDash() const
{
if (!m_lineDashDirty)
return;
- if (m_lineDash.size() == 0) {
+ if (!hasANonZeroElement(m_lineDash)) {
Stephen White 2015/10/01 15:46:02 Please create a Skia bug for this (diff between hw
Justin Novosad 2015/10/01 16:06:42 I'll create a skia bug, but I don't think this wor
Stephen White 2015/10/01 16:54:44 Acknowledged.
m_strokePaint.setPathEffect(0);
} else {
RefPtr<SkPathEffect> dashPathEffect = adoptRef(SkDashPathEffect::Create(m_lineDash.data(), m_lineDash.size(), m_lineDashOffset));

Powered by Google App Engine
This is Rietveld 408576698