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

Unified Diff: third_party/WebKit/Source/platform/graphics/StrokeData.h

Issue 2737063002: Improve dashed line drawing (Closed)
Patch Set: Created 3 years, 9 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/platform/graphics/StrokeData.h
diff --git a/third_party/WebKit/Source/platform/graphics/StrokeData.h b/third_party/WebKit/Source/platform/graphics/StrokeData.h
index f39dffc800ad3aa7bc142282faa75283ec971a6d..e3e1f7bcd42ea49d2f8b5744b92c5acceaf0a609 100644
--- a/third_party/WebKit/Source/platform/graphics/StrokeData.h
+++ b/third_party/WebKit/Source/platform/graphics/StrokeData.h
@@ -87,6 +87,21 @@ class PLATFORM_EXPORT StrokeData final {
// is specified but the line width is too small to draw circles.
static bool strokeIsDashed(float width, StrokeStyle);
+ // The length of the dash relative to the line thickness for dashed stroking.
+ // A different dash length may be used when dashes are adjusted to better
+ // fit a given length path.
+ static float dashLengthRatio(float thickness) {
+ return thickness >= 3 ? 2.0 : 3.0;
+ }
+
+ // The length of the gap between dashes relative to the line thickness for
+ // dashed stroking. A different gap may be used when dashes are adjusted to
+ // better fit a given length path. Thin lines need longer dashes to avoid
+ // looking like dots when drawn.
+ static float dashGapRatio(float thickness) {
+ return thickness >= 3 ? 1.0 : 2.0;
+ }
+
private:
StrokeStyle m_style;
float m_thickness;

Powered by Google App Engine
This is Rietveld 408576698