| Index: Source/platform/graphics/GraphicsContextState.cpp
|
| diff --git a/Source/platform/graphics/GraphicsContextState.cpp b/Source/platform/graphics/GraphicsContextState.cpp
|
| index ee7d5ac67bbed8bec384e24d93843cadab8f969c..657d0df5fb03942dbf1f6e356445b25f861889f6 100644
|
| --- a/Source/platform/graphics/GraphicsContextState.cpp
|
| +++ b/Source/platform/graphics/GraphicsContextState.cpp
|
| @@ -10,7 +10,8 @@
|
| namespace blink {
|
|
|
| GraphicsContextState::GraphicsContextState()
|
| - : m_fillColor(Color::black)
|
| + : m_strokeColor(Color::black)
|
| + , m_fillColor(Color::black)
|
| , m_fillRule(RULE_NONZERO)
|
| , m_textDrawingMode(TextModeFill)
|
| , m_alpha(256)
|
| @@ -23,7 +24,7 @@ GraphicsContextState::GraphicsContextState()
|
| {
|
| m_strokePaint.setStyle(SkPaint::kStroke_Style);
|
| m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness()));
|
| - m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb()));
|
| + m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
|
| m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap);
|
| m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join);
|
| m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit()));
|
| @@ -38,6 +39,9 @@ GraphicsContextState::GraphicsContextState(const GraphicsContextState& other)
|
| : m_strokePaint(other.m_strokePaint)
|
| , m_fillPaint(other.m_fillPaint)
|
| , m_strokeData(other.m_strokeData)
|
| + , m_strokeColor(other.m_strokeColor)
|
| + , m_strokeGradient(other.m_strokeGradient)
|
| + , m_strokePattern(other.m_strokePattern)
|
| , m_fillColor(other.m_fillColor)
|
| , m_fillRule(other.m_fillRule)
|
| , m_fillGradient(other.m_fillGradient)
|
| @@ -61,8 +65,8 @@ void GraphicsContextState::copy(const GraphicsContextState& source)
|
|
|
| const SkPaint& GraphicsContextState::strokePaint(int strokedPathLength) const
|
| {
|
| - if (m_strokeData.gradient() && m_strokeData.gradient()->shaderChanged())
|
| - m_strokePaint.setShader(m_strokeData.gradient()->shader());
|
| + if (m_strokeGradient && m_strokeGradient->shaderChanged())
|
| + m_strokePaint.setShader(m_strokeGradient->shader());
|
| m_strokeData.setupPaintDashPathEffect(&m_strokePaint, strokedPathLength);
|
| return m_strokePaint;
|
| }
|
| @@ -87,43 +91,43 @@ void GraphicsContextState::setStrokeThickness(float thickness)
|
|
|
| void GraphicsContextState::setStrokeColor(const Color& color)
|
| {
|
| - m_strokeData.clearGradient();
|
| - m_strokeData.clearPattern();
|
| - m_strokeData.setColor(color);
|
| + m_strokeGradient.clear();
|
| + m_strokePattern.clear();
|
| + m_strokeColor = color;
|
| m_strokePaint.setColor(applyAlpha(color.rgb()));
|
| m_strokePaint.setShader(0);
|
| }
|
|
|
| void GraphicsContextState::setStrokeGradient(const PassRefPtr<Gradient> gradient)
|
| {
|
| - m_strokeData.setColor(Color::black);
|
| - m_strokeData.clearPattern();
|
| - m_strokeData.setGradient(gradient);
|
| + m_strokeColor = Color::black;
|
| + m_strokePattern.clear();
|
| + m_strokeGradient = gradient;
|
| m_strokePaint.setColor(applyAlpha(SK_ColorBLACK));
|
| - m_strokePaint.setShader(m_strokeData.gradient()->shader());
|
| + m_strokePaint.setShader(m_strokeGradient->shader());
|
| }
|
|
|
| void GraphicsContextState::clearStrokeGradient()
|
| {
|
| - m_strokeData.clearGradient();
|
| - ASSERT(!m_strokeData.pattern());
|
| - m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb()));
|
| + m_strokeGradient.clear();
|
| + ASSERT(!m_strokePattern);
|
| + m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
|
| }
|
|
|
| void GraphicsContextState::setStrokePattern(const PassRefPtr<Pattern> pattern)
|
| {
|
| - m_strokeData.setColor(Color::black);
|
| - m_strokeData.clearGradient();
|
| - m_strokeData.setPattern(pattern);
|
| + m_strokeColor = Color::black;
|
| + m_strokeGradient.clear();
|
| + m_strokePattern = pattern;
|
| m_strokePaint.setColor(applyAlpha(SK_ColorBLACK));
|
| - m_strokePaint.setShader(m_strokeData.pattern()->shader());
|
| + m_strokePaint.setShader(m_strokePattern->shader());
|
| }
|
|
|
| void GraphicsContextState::clearStrokePattern()
|
| {
|
| - m_strokeData.clearPattern();
|
| - ASSERT(!m_strokeData.gradient());
|
| - m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb()));
|
| + m_strokePattern.clear();
|
| + ASSERT(!m_strokeGradient);
|
| + m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
|
| }
|
|
|
| void GraphicsContextState::setLineCap(LineCap cap)
|
| @@ -209,7 +213,7 @@ void GraphicsContextState::setAlphaAsFloat(float alpha)
|
| if (m_alpha > 256)
|
| m_alpha = 256;
|
| }
|
| - m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb()));
|
| + m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
|
| m_fillPaint.setColor(applyAlpha(m_fillColor.rgb()));
|
| }
|
|
|
|
|