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

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

Issue 150973004: Fixes the rendering of a SVG filter (e.g. feFlood) by testing against total (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added rebaseline test. Created 6 years, 10 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/core/rendering/FilterEffectRenderer.cpp ('k') | Source/platform/graphics/filters/FilterEffect.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 35472a5471bd3a18f47a78a656dfe156dad5e1f8..8804a56fd04cd936e0f72d46f370f72c6199fbf3 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
@@ -109,17 +109,17 @@ PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter*
bool RenderSVGResourceFilter::fitsInMaximumImageSize(const FloatSize& size, FloatSize& scale)
{
- bool matchesFilterSize = true;
- if (size.width() * scale.width() > kMaxFilterSize) {
- scale.setWidth(kMaxFilterSize / size.width());
- matchesFilterSize = false;
- }
- if (size.height() * scale.height() > kMaxFilterSize) {
- scale.setHeight(kMaxFilterSize / size.height());
- matchesFilterSize = false;
- }
+ FloatSize scaledSize(size);
+ scaledSize.scale(scale.width(), scale.height());
+ float scaledArea = scaledSize.width() * scaledSize.height();
+
+ if (scaledArea <= FilterEffect::maxFilterArea())
+ return true;
- return matchesFilterSize;
+ // If area of scaled size is bigger than the upper limit, adjust the scale
+ // to fit.
+ scale.scale(sqrt(FilterEffect::maxFilterArea() / scaledArea));
+ return false;
}
static bool createImageBuffer(const Filter* filter, OwnPtr<ImageBuffer>& imageBuffer, bool accelerated)
« no previous file with comments | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/platform/graphics/filters/FilterEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698