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

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

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: pdr corrections + needsrebaselines Created 5 years, 7 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: Source/platform/graphics/GraphicsContextState.cpp
diff --git a/Source/platform/graphics/GraphicsContextState.cpp b/Source/platform/graphics/GraphicsContextState.cpp
index 02ba5f1d43b6f848a666e903efa16864753e143b..d654ff0dcbd7a567738a177bda3372aed9f5f27d 100644
--- a/Source/platform/graphics/GraphicsContextState.cpp
+++ b/Source/platform/graphics/GraphicsContextState.cpp
@@ -12,22 +12,19 @@ GraphicsContextState::GraphicsContextState()
, m_fillColor(Color::black)
, m_fillRule(RULE_NONZERO)
, m_textDrawingMode(TextModeFill)
- , m_alpha(256)
- , m_compositeOperation(SkXfermode::kSrcOver_Mode)
, m_interpolationQuality(InterpolationDefault)
, m_saveCount(0)
, m_shouldAntialias(true)
- , m_shouldClampToSourceRect(true)
{
m_strokePaint.setStyle(SkPaint::kStroke_Style);
m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness()));
- m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
+ m_strokePaint.setColor(m_strokeColor.rgb());
m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap);
m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join);
m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit()));
m_strokePaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(m_interpolationQuality));
m_strokePaint.setAntiAlias(m_shouldAntialias);
- m_fillPaint.setColor(applyAlpha(m_fillColor.rgb()));
+ m_fillPaint.setColor(m_fillColor.rgb());
m_fillPaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(m_interpolationQuality));
m_fillPaint.setAntiAlias(m_shouldAntialias);
}
@@ -44,15 +41,11 @@ GraphicsContextState::GraphicsContextState(const GraphicsContextState& other)
, m_fillGradient(other.m_fillGradient)
, m_fillPattern(other.m_fillPattern)
, m_looper(other.m_looper)
- , m_dropShadowImageFilter(other.m_dropShadowImageFilter)
, m_textDrawingMode(other.m_textDrawingMode)
- , m_alpha(other.m_alpha)
, m_colorFilter(other.m_colorFilter)
- , m_compositeOperation(other.m_compositeOperation)
, m_interpolationQuality(other.m_interpolationQuality)
, m_saveCount(0)
- , m_shouldAntialias(other.m_shouldAntialias)
- , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) { }
+ , m_shouldAntialias(other.m_shouldAntialias) { }
void GraphicsContextState::copy(const GraphicsContextState& source)
{
@@ -91,7 +84,7 @@ void GraphicsContextState::setStrokeColor(const Color& color)
m_strokeGradient.clear();
m_strokePattern.clear();
m_strokeColor = color;
- m_strokePaint.setColor(applyAlpha(color.rgb()));
+ m_strokePaint.setColor(color.rgb());
m_strokePaint.setShader(0);
}
@@ -100,7 +93,7 @@ void GraphicsContextState::setStrokeGradient(const PassRefPtr<Gradient> gradient
m_strokeColor = Color::black;
m_strokePattern.clear();
m_strokeGradient = gradient;
- m_strokePaint.setColor(scaleAlpha(applyAlpha(SK_ColorBLACK), alpha));
+ m_strokePaint.setColor(scaleAlpha(SK_ColorBLACK, alpha));
m_strokePaint.setShader(m_strokeGradient->shader());
}
@@ -109,7 +102,7 @@ void GraphicsContextState::setStrokePattern(const PassRefPtr<Pattern> pattern, f
m_strokeColor = Color::black;
m_strokeGradient.clear();
m_strokePattern = pattern;
- m_strokePaint.setColor(scaleAlpha(applyAlpha(SK_ColorBLACK), alpha));
+ m_strokePaint.setColor(scaleAlpha(SK_ColorBLACK, alpha));
m_strokePaint.setShader(m_strokePattern->shader());
}
@@ -136,7 +129,7 @@ void GraphicsContextState::setFillColor(const Color& color)
m_fillColor = color;
m_fillGradient.clear();
m_fillPattern.clear();
- m_fillPaint.setColor(applyAlpha(color.rgb()));
+ m_fillPaint.setColor(color.rgb());
m_fillPaint.setShader(0);
}
@@ -145,7 +138,7 @@ void GraphicsContextState::setFillGradient(const PassRefPtr<Gradient> gradient,
m_fillColor = Color::black;
m_fillPattern.clear();
m_fillGradient = gradient;
- m_fillPaint.setColor(scaleAlpha(applyAlpha(SK_ColorBLACK), alpha));
+ m_fillPaint.setColor(scaleAlpha(SK_ColorBLACK, alpha));
m_fillPaint.setShader(m_fillGradient->shader());
}
@@ -154,7 +147,7 @@ void GraphicsContextState::setFillPattern(const PassRefPtr<Pattern> pattern, flo
m_fillColor = Color::black;
m_fillGradient.clear();
m_fillPattern = pattern;
- m_fillPaint.setColor(scaleAlpha(applyAlpha(SK_ColorBLACK), alpha));
+ m_fillPaint.setColor(scaleAlpha(SK_ColorBLACK, alpha));
m_fillPaint.setShader(m_fillPattern->shader());
}
@@ -173,23 +166,6 @@ void GraphicsContextState::clearDrawLooper()
m_fillPaint.setLooper(0);
}
-void GraphicsContextState::setDropShadowImageFilter(PassRefPtr<SkImageFilter> dropShadowImageFilter)
-{
- m_dropShadowImageFilter = dropShadowImageFilter;
-}
-
-void GraphicsContextState::clearDropShadowImageFilter()
-{
- m_dropShadowImageFilter.clear();
-}
-
-void GraphicsContextState::setAlphaAsFloat(float alpha)
-{
- m_alpha = clampedAlphaForBlending(alpha);
- m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb()));
- m_fillPaint.setColor(applyAlpha(m_fillColor.rgb()));
-}
-
void GraphicsContextState::setLineDash(const DashArray& dashes, float dashOffset)
{
m_strokeData.setLineDash(dashes, dashOffset);
@@ -202,13 +178,6 @@ void GraphicsContextState::setColorFilter(PassRefPtr<SkColorFilter> colorFilter)
m_fillPaint.setColorFilter(m_colorFilter.get());
}
-void GraphicsContextState::setCompositeOperation(SkXfermode::Mode xferMode)
-{
- m_compositeOperation = xferMode;
- m_strokePaint.setXfermodeMode(xferMode);
- m_fillPaint.setXfermodeMode(xferMode);
-}
-
void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality)
{
m_interpolationQuality = quality;

Powered by Google App Engine
This is Rietveld 408576698