diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp b/chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp index 75fb7ca6314..61b4f87826d 100644 --- a/chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp +++ b/chromium/third_party/WebKit/Source/platform/graphics/StrokeData.cpp @@ -54,19 +54,23 @@ void StrokeData::setLineDash(const DashArray& dashes, float dashOffset) for (unsigned i = 0; i < count; i++) intervals[i] = dashes[i % dashLength]; - m_dash = adoptRef(new SkDashPathEffect(intervals.get(), count, dashOffset)); + m_dash = adoptRef(SkDashPathEffect::Create(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. @@ -100,12 +105,10 @@ float StrokeData::setupPaint(SkPaint* paint, int length) const } SkScalar dashLengthSk = SkIntToScalar(dashLength); SkScalar intervals[2] = { dashLengthSk, dashLengthSk }; - RefPtr<SkDashPathEffect> pathEffect = adoptRef(new SkDashPathEffect(intervals, 2, SkIntToScalar(phase))); + RefPtr<SkDashPathEffect> pathEffect = adoptRef(SkDashPathEffect::Create(intervals, 2, SkIntToScalar(phase))); paint->setPathEffect(pathEffect.get()); } } - - return width; } } // namespace |