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

Unified Diff: Source/platform/graphics/StrokeData.cpp

Issue 169283008: Maintain SkPaint in GraphicsContextState. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: A couple more optimizations. Created 6 years, 10 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 | « Source/platform/graphics/StrokeData.h ('k') | Source/web/tests/GraphicsContextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/StrokeData.cpp
diff --git a/Source/platform/graphics/StrokeData.cpp b/Source/platform/graphics/StrokeData.cpp
index 75fb7ca63141b19be25506d9d2d601b67ed6cb59..be2a1c759d81e2d13b2bfb52ea049f5c0ecb43b2 100644
--- a/Source/platform/graphics/StrokeData.cpp
+++ b/Source/platform/graphics/StrokeData.cpp
@@ -57,16 +57,20 @@ void StrokeData::setLineDash(const DashArray& dashes, float dashOffset)
m_dash = adoptRef(new SkDashPathEffect(intervals.get(), count, dashOffset));
}
-float StrokeData::setupPaint(SkPaint* paint, int length) const
+void StrokeData::setupPaint(SkPaint* paint, int length) const
{
- float width = m_thickness;
-
paint->setStyle(SkPaint::kStroke_Style);
- paint->setStrokeWidth(SkFloatToScalar(width));
+ paint->setStrokeWidth(SkFloatToScalar(m_thickness));
paint->setStrokeCap(m_lineCap);
paint->setStrokeJoin(m_lineJoin);
paint->setStrokeMiter(SkFloatToScalar(m_miterLimit));
+ setupPaintDashPathEffect(paint, length);
+}
+
+void StrokeData::setupPaintDashPathEffect(SkPaint* paint, int length) const
+{
+ float width = m_thickness;
if (m_dash) {
paint->setPathEffect(m_dash.get());
} else {
@@ -75,7 +79,8 @@ float StrokeData::setupPaint(SkPaint* paint, int length) const
case SolidStroke:
case DoubleStroke:
case WavyStroke: // FIXME: https://code.google.com/p/chromium/issues/detail?id=229574
- break;
+ paint->setPathEffect(0);
+ return;
case DashedStroke:
width = dashRatio * width;
// Fall through.
@@ -104,8 +109,6 @@ float StrokeData::setupPaint(SkPaint* paint, int length) const
paint->setPathEffect(pathEffect.get());
}
}
-
- return width;
}
} // namespace
« no previous file with comments | « Source/platform/graphics/StrokeData.h ('k') | Source/web/tests/GraphicsContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698