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

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

Issue 871983003: [Slimming Paint] Implement deferred SVG filters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add note 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/core/rendering/svg/SVGRenderingContext.h ('k') | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGRenderingContext.cpp
diff --git a/Source/core/rendering/svg/SVGRenderingContext.cpp b/Source/core/rendering/svg/SVGRenderingContext.cpp
index fade7cdbfc7ac74d9b8230b186e54624e8465a31..70ddd867c2690740bafaff234da8a72ad1b847c1 100644
--- a/Source/core/rendering/svg/SVGRenderingContext.cpp
+++ b/Source/core/rendering/svg/SVGRenderingContext.cpp
@@ -34,6 +34,7 @@
#include "core/rendering/svg/SVGResources.h"
#include "core/rendering/svg/SVGResourcesCache.h"
#include "platform/FloatConversion.h"
+#include "platform/graphics/paint/DrawingRecorder.h"
namespace blink {
@@ -42,7 +43,15 @@ SVGRenderingContext::~SVGRenderingContext()
if (m_filter) {
ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->filter() == m_filter);
- m_filter->finishEffect(m_object, m_paintInfo.context);
+
+ DrawingRecorder recorder(m_originalPaintInfo->context, m_object->displayItemClient(), DisplayItem::SVGFilter, LayoutRect::infiniteRect());
+ m_filter->finishEffect(m_object, m_originalPaintInfo->context);
+
+ // Reset the paint info after the filter effect has been completed.
+ // This isn't strictly required (e.g., m_paintInfo.rect is not used
+ // after this).
+ m_paintInfo.context = m_originalPaintInfo->context;
+ m_paintInfo.rect = m_originalPaintInfo->rect;
}
if (m_masker) {
@@ -149,10 +158,15 @@ bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources)
if (m_object->style()->svgStyle().hasFilter())
return false;
} else if (RenderSVGResourceFilter* filter = resources->filter()) {
- if (!filter->prepareEffect(m_object, m_paintInfo.context))
+ GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paintInfo.context);
+ if (!filterContext)
return false;
m_filter = filter;
+ // Because the filter needs to cache its contents we replace the context
+ // during filtering with the filter's context.
+ m_paintInfo.context = filterContext;
+
// Because we cache the filter contents and do not invalidate on paint
// invalidation rect changes, we need to paint the entire filter region
// so elements outside the initial paint (due to scrolling, etc) paint.
« no previous file with comments | « Source/core/rendering/svg/SVGRenderingContext.h ('k') | Source/platform/graphics/paint/DisplayItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698