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

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

Issue 661053003: Make beginLayer() and CanvasRenderingContext2D use SkXfermode::Mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to ToT Created 5 years, 11 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/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index 3419592710bb31c9b9410951073915305e1cc440..e72194b07d6c593f1f32afafef6fe0aad09d2e51 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -438,11 +438,27 @@ bool GraphicsContext::couldUseLCDRenderedText() const
return m_isCertainlyOpaque && m_shouldSmoothFonts;
}
-void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, WebBlendMode blendMode)
+void GraphicsContext::setCompositeOperation(SkXfermode::Mode xferMode)
{
if (contextDisabled())
return;
- mutableState()->setCompositeOperation(compositeOperation, blendMode);
+ mutableState()->setCompositeOperation(xferMode);
+}
+
+void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, WebBlendMode blendMode)
+{
+ SkXfermode::Mode xferMode = WebCoreCompositeToSkiaComposite(compositeOperation, blendMode);
+ setCompositeOperation(xferMode);
+}
+
+CompositeOperator GraphicsContext::compositeOperation() const
+{
+ return compositeOperatorFromSkia(immutableState()->compositeOperation());
+}
+
+WebBlendMode GraphicsContext::blendModeOperation() const
+{
+ return blendModeFromSkia(immutableState()->compositeOperation());
}
SkColorFilter* GraphicsContext::colorFilter() const
@@ -494,17 +510,17 @@ void GraphicsContext::concat(const SkMatrix& matrix)
void GraphicsContext::beginTransparencyLayer(float opacity, const FloatRect* bounds)
{
- beginLayer(opacity, immutableState()->compositeOperator(), bounds);
+ beginLayer(opacity, immutableState()->compositeOperation(), bounds);
}
-void GraphicsContext::beginLayer(float opacity, CompositeOperator op, const FloatRect* bounds, ColorFilter colorFilter, ImageFilter* imageFilter)
+void GraphicsContext::beginLayer(float opacity, SkXfermode::Mode xfermode, const FloatRect* bounds, ColorFilter colorFilter, ImageFilter* imageFilter)
{
if (contextDisabled())
return;
SkPaint layerPaint;
layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255));
- layerPaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, m_paintState->blendMode()));
+ layerPaint.setXfermodeMode(xfermode);
layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).get());
layerPaint.setImageFilter(imageFilter);
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | Source/platform/graphics/GraphicsContextState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698