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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp

Issue 1543593002: Forward fill and stroke styles from 2d canvas to canvas filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PaintFilterEffect::affectsTransparentPixels Created 4 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
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
index 466850eef937b89985b5aa6c4ca66ac64a201b5e..71f1564cd33b96301deb0625dda26a6ea970a15e 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp
@@ -354,12 +354,19 @@ SkImageFilter* CanvasRenderingContext2DState::getFilter(Element* styleResolution
StyleResolverState resolverState(styleResolutionHost->document(), styleResolutionHost, filterStyle.get());
resolverState.setStyle(filterStyle);
- // TODO(junov): crbug.com/502877 Feed m_fillStyle and m_strokeStyle into FillPaint and
- // StrokePaint respectively for filters that reference SVG.
StyleBuilder::applyProperty(CSSPropertyWebkitFilter, resolverState, m_filterValue.get());
RefPtrWillBeRawPtr<FilterEffectBuilder> filterEffectBuilder = FilterEffectBuilder::create();
+
+ // We can't reuse m_fillPaint and m_strokePaint for the filter, since these incorporate
+ // the global alpha, which isn't applicable here.
+ SkPaint fillPaintForFilter;
+ SkPaint strokePaintForFilter;
+ m_fillStyle->applyToPaint(fillPaintForFilter);
+ m_strokeStyle->applyToPaint(strokePaintForFilter);
+ fillPaintForFilter.setColor(m_fillStyle->paintColor());
+ strokePaintForFilter.setColor(m_strokeStyle->paintColor());
const double effectiveZoom = 1.0; // Deliberately ignore zoom on the canvas element
- filterEffectBuilder->build(styleResolutionHost, filterStyle->filter(), effectiveZoom);
+ filterEffectBuilder->build(styleResolutionHost, filterStyle->filter(), effectiveZoom, &fillPaintForFilter, &strokePaintForFilter);
SkiaImageFilterBuilder imageFilterBuilder;
RefPtrWillBeRawPtr<FilterEffect> lastEffect = filterEffectBuilder->lastEffect();

Powered by Google App Engine
This is Rietveld 408576698