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

Unified Diff: Source/platform/graphics/filters/FilterEffect.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: 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
Index: Source/platform/graphics/filters/FilterEffect.cpp
diff --git a/Source/platform/graphics/filters/FilterEffect.cpp b/Source/platform/graphics/filters/FilterEffect.cpp
index ce8f23f723481bd38b66d3446078b5c987ae6b66..29de7979b4bff5f31442bedacb9236095c94cf45 100644
--- a/Source/platform/graphics/filters/FilterEffect.cpp
+++ b/Source/platform/graphics/filters/FilterEffect.cpp
@@ -36,6 +36,9 @@
namespace WebCore {
+const float FilterEffect::kMaxFilterArea(2 << 21);
fs 2014/02/07 10:17:51 Nit: I think this would read more easily as "2048
Stephen Chennney 2014/02/11 14:47:21 Yeah. I wanted 4096 x 4096. static const float kM
+
+
FilterEffect::FilterEffect(Filter* filter)
: m_alphaImage(false)
, m_filter(filter)
@@ -54,11 +57,27 @@ FilterEffect::~FilterEffect()
{
}
-inline bool isFilterSizeValid(IntRect rect)
+float FilterEffect::maxFilterArea()
{
- if (rect.width() < 0 || rect.width() > kMaxFilterSize
- || rect.height() < 0 || rect.height() > kMaxFilterSize)
+ return kMaxFilterArea;
+}
+
+bool FilterEffect::isFilterSizeValid(FloatRect rect)
Stephen Chennney 2014/02/11 14:47:21 Should be const FloatRect&.
+{
+ if (rect.width() < 0 || rect.height() < 0
+ || (rect.height() * rect.width() > kMaxFilterArea))
return false;
+
+ return true;
+}
+
+
+bool FilterEffect::isFilterSizeValid(IntRect rect)
Stephen Chennney 2014/02/11 14:47:21 Should be const IntRect&.
+{
+ if (rect.width() < 0 || rect.height() < 0
+ || (rect.height() * rect.width() > kMaxFilterArea))
Stephen White 2014/02/11 15:20:35 Is there is a danger of overflow here? The multipl
+ return false;
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698