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

Unified Diff: Source/core/rendering/svg/RenderSVGResourceFilter.cpp

Issue 208683008: Fix deferred filter application with shearing or rotating CTM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixes per review comments; update to ToT. Created 6 years, 9 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 | « no previous file | Source/platform/graphics/filters/SkiaImageFilterBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGResourceFilter.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
index d8688a862b3afbd7876b1b67ef7dcbc511ebdf44..c45fd68b8cc4aacb1c627a5b25bc98136d8f8b2a 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
@@ -232,7 +232,23 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
// Scale the CTM so the primitive is drawn to filterRes.
context->scale(filterResScale);
// Create a resize filter with the inverse scale.
- imageFilter = builder.buildResize(1 / filterResScale.width(), 1 / filterResScale.height(), imageFilter.get());
+ AffineTransform resizeMatrix;
+ resizeMatrix.scale(1 / filterResScale.width(), 1 / filterResScale.height());
+ imageFilter = builder.buildTransform(resizeMatrix, imageFilter.get());
+ }
+ // If the CTM contains rotation or shearing, apply the filter to
+ // the unsheared/unrotated matrix, and do the shearing/rotation
+ // as a final pass.
+ AffineTransform ctm = context->getCTM();
+ if (ctm.b() || ctm.c()) {
+ AffineTransform scaleAndTranslate;
+ scaleAndTranslate.translate(ctm.e(), ctm.f());
+ scaleAndTranslate.scale(ctm.xScale(), ctm.yScale());
+ ASSERT(scaleAndTranslate.isInvertible());
+ AffineTransform shearAndRotate = scaleAndTranslate.inverse();
+ shearAndRotate.multiply(ctm);
+ context->setCTM(scaleAndTranslate);
+ imageFilter = builder.buildTransform(shearAndRotate, imageFilter.get());
}
context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, imageFilter.get());
return true;
« no previous file with comments | « no previous file | Source/platform/graphics/filters/SkiaImageFilterBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698