Chromium Code Reviews| Index: Source/platform/graphics/GraphicsContextState.cpp |
| diff --git a/Source/platform/graphics/GraphicsContextState.cpp b/Source/platform/graphics/GraphicsContextState.cpp |
| index a87bafe2a852ecdb0f916795e79e5982ed1f8cec..39fbf89eb777a7d04d525a3e7f735a17696ebbe2 100644 |
| --- a/Source/platform/graphics/GraphicsContextState.cpp |
| +++ b/Source/platform/graphics/GraphicsContextState.cpp |
| @@ -99,12 +99,12 @@ void GraphicsContextState::setStrokeColor(const Color& color) |
| m_strokePaint.setShader(0); |
| } |
| -void GraphicsContextState::setStrokeGradient(const PassRefPtr<Gradient> gradient) |
| +void GraphicsContextState::setStrokeGradient(const PassRefPtr<Gradient> gradient, float additionalAlpha) |
| { |
| m_strokeColor = Color::black; |
| m_strokePattern.clear(); |
| m_strokeGradient = gradient; |
| - m_strokePaint.setColor(applyAlpha(SK_ColorBLACK)); |
| + m_strokePaint.setColor(combineWithAlpha(applyAlpha(SK_ColorBLACK), additionalAlpha)); |
| m_strokePaint.setShader(m_strokeGradient->shader()); |
| } |
| @@ -115,12 +115,12 @@ void GraphicsContextState::clearStrokeGradient() |
| m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); |
| } |
| -void GraphicsContextState::setStrokePattern(const PassRefPtr<Pattern> pattern) |
| +void GraphicsContextState::setStrokePattern(const PassRefPtr<Pattern> pattern, float additionalAlpha) |
| { |
| m_strokeColor = Color::black; |
| m_strokeGradient.clear(); |
| m_strokePattern = pattern; |
| - m_strokePaint.setColor(applyAlpha(SK_ColorBLACK)); |
| + m_strokePaint.setColor(combineWithAlpha(applyAlpha(SK_ColorBLACK), additionalAlpha)); |
| m_strokePaint.setShader(m_strokePattern->shader()); |
| } |
| @@ -158,12 +158,12 @@ void GraphicsContextState::setFillColor(const Color& color) |
| m_fillPaint.setShader(0); |
| } |
| -void GraphicsContextState::setFillGradient(const PassRefPtr<Gradient> gradient) |
| +void GraphicsContextState::setFillGradient(const PassRefPtr<Gradient> gradient, float additionalAlpha) |
| { |
| m_fillColor = Color::black; |
| m_fillPattern.clear(); |
| m_fillGradient = gradient; |
| - m_fillPaint.setColor(applyAlpha(SK_ColorBLACK)); |
| + m_fillPaint.setColor(combineWithAlpha(applyAlpha(SK_ColorBLACK), additionalAlpha)); |
| m_fillPaint.setShader(m_fillGradient->shader()); |
| } |
| @@ -174,12 +174,12 @@ void GraphicsContextState::clearFillGradient() |
| m_fillPaint.setColor(applyAlpha(m_fillColor.rgb())); |
| } |
| -void GraphicsContextState::setFillPattern(const PassRefPtr<Pattern> pattern) |
| +void GraphicsContextState::setFillPattern(const PassRefPtr<Pattern> pattern, float additionalAlpha) |
| { |
| m_fillColor = Color::black; |
| m_fillGradient.clear(); |
| m_fillPattern = pattern; |
| - m_fillPaint.setColor(applyAlpha(SK_ColorBLACK)); |
| + m_fillPaint.setColor(combineWithAlpha(applyAlpha(SK_ColorBLACK), additionalAlpha)); |
| m_fillPaint.setShader(m_fillPattern->shader()); |
| } |
| @@ -217,13 +217,7 @@ void GraphicsContextState::clearDropShadowImageFilter() |
| void GraphicsContextState::setAlphaAsFloat(float alpha) |
| { |
| - if (alpha < 0) { |
| - m_alpha = 0; |
| - } else { |
| - m_alpha = roundf(alpha * 256); |
| - if (m_alpha > 256) |
| - m_alpha = 256; |
| - } |
| + m_alpha = clampedAlphaForBlending(alpha); |
|
chrishtr
2015/02/02 23:14:54
This is the one place that reads m_alpha it seems:
pdr.
2015/02/03 00:09:48
GraphicsContext::preparePaintForDrawRectToRect is
|
| m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); |
| m_fillPaint.setColor(applyAlpha(m_fillColor.rgb())); |
| } |