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

Side by Side 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: Cleanup, and update expectation 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 16 matching lines...) Expand all
27 27
28 #include "core/frame/FrameHost.h" 28 #include "core/frame/FrameHost.h"
29 #include "core/rendering/PaintInfo.h" 29 #include "core/rendering/PaintInfo.h"
30 #include "core/rendering/RenderLayer.h" 30 #include "core/rendering/RenderLayer.h"
31 #include "core/rendering/svg/RenderSVGResourceFilter.h" 31 #include "core/rendering/svg/RenderSVGResourceFilter.h"
32 #include "core/rendering/svg/RenderSVGResourceMasker.h" 32 #include "core/rendering/svg/RenderSVGResourceMasker.h"
33 #include "core/rendering/svg/SVGRenderSupport.h" 33 #include "core/rendering/svg/SVGRenderSupport.h"
34 #include "core/rendering/svg/SVGResources.h" 34 #include "core/rendering/svg/SVGResources.h"
35 #include "core/rendering/svg/SVGResourcesCache.h" 35 #include "core/rendering/svg/SVGResourcesCache.h"
36 #include "platform/FloatConversion.h" 36 #include "platform/FloatConversion.h"
37 #include "platform/graphics/paint/DrawingRecorder.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 SVGRenderingContext::~SVGRenderingContext() 41 SVGRenderingContext::~SVGRenderingContext()
41 { 42 {
42 if (m_filter) { 43 if (m_filter) {
43 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); 44 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
44 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->filt er() == m_filter); 45 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->filt er() == m_filter);
45 m_filter->finishEffect(m_object, m_paintInfo.context); 46
47 DrawingRecorder recorder(m_originalPaintInfo->context, m_object->display ItemClient(), DisplayItem::SVGFilter, LayoutRect::infiniteRect());
48 m_filter->finishEffect(m_object, m_originalPaintInfo->context);
49
50 // Reset the paint info after the filter effect has been completed.
51 m_paintInfo.context = m_originalPaintInfo->context;
52 m_paintInfo.rect = m_originalPaintInfo->rect;
fs 2015/01/26 09:47:11 m_paintInfo.rect is "dead" at this point (not used
pdr. 2015/01/28 01:04:39 Yeah, I thought it would be clean to fully clean u
46 } 53 }
47 54
48 if (m_masker) { 55 if (m_masker) {
49 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); 56 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
50 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->mask er() == m_masker); 57 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->mask er() == m_masker);
51 m_masker->finishEffect(m_object, m_paintInfo.context); 58 m_masker->finishEffect(m_object, m_paintInfo.context);
52 } 59 }
53 60
54 if (m_clipper) { 61 if (m_clipper) {
55 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); 62 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 149 }
143 return true; 150 return true;
144 } 151 }
145 152
146 bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources) 153 bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources)
147 { 154 {
148 if (!resources) { 155 if (!resources) {
149 if (m_object->style()->svgStyle().hasFilter()) 156 if (m_object->style()->svgStyle().hasFilter())
150 return false; 157 return false;
151 } else if (RenderSVGResourceFilter* filter = resources->filter()) { 158 } else if (RenderSVGResourceFilter* filter = resources->filter()) {
152 if (!filter->prepareEffect(m_object, m_paintInfo.context)) 159 GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paint Info.context);
160 if (!filterContext)
153 return false; 161 return false;
154 m_filter = filter; 162 m_filter = filter;
155 163
164 // Because the filter needs to cache its contents we replace the context
165 // during filtering with the filter's context.
166 m_paintInfo.context = filterContext;
167
156 // Because we cache the filter contents and do not invalidate on paint 168 // Because we cache the filter contents and do not invalidate on paint
157 // invalidation rect changes, we need to paint the entire filter region 169 // invalidation rect changes, we need to paint the entire filter region
158 // so elements outside the initial paint (due to scrolling, etc) paint. 170 // so elements outside the initial paint (due to scrolling, etc) paint.
159 m_paintInfo.rect = LayoutRect::infiniteIntRect(); 171 m_paintInfo.rect = LayoutRect::infiniteIntRect();
160 } 172 }
161 return true; 173 return true;
162 } 174 }
163 175
164 bool SVGRenderingContext::isIsolationInstalled() const 176 bool SVGRenderingContext::isIsolationInstalled() const
165 { 177 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 { 248 {
237 ASSERT(context); 249 ASSERT(context);
238 ASSERT(item); 250 ASSERT(item);
239 ASSERT(!item->needsLayout()); 251 ASSERT(!item->needsLayout());
240 252
241 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 253 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
242 item->paint(info, IntPoint()); 254 item->paint(info, IntPoint());
243 } 255 }
244 256
245 } // namespace blink 257 } // namespace blink
OLDNEW
« 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