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

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: 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 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 // This isn't strictly required (e.g., m_paintInfo.rect is not used
52 // after this).
53 m_paintInfo.context = m_originalPaintInfo->context;
54 m_paintInfo.rect = m_originalPaintInfo->rect;
46 } 55 }
47 56
48 if (m_masker) { 57 if (m_masker) {
49 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); 58 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
50 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->mask er() == m_masker); 59 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->mask er() == m_masker);
51 m_masker->finishEffect(m_object, m_paintInfo.context); 60 m_masker->finishEffect(m_object, m_paintInfo.context);
52 } 61 }
53 62
54 if (m_clipper) { 63 if (m_clipper) {
55 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)); 64 ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 151 }
143 return true; 152 return true;
144 } 153 }
145 154
146 bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources) 155 bool SVGRenderingContext::applyFilterIfNecessary(SVGResources* resources)
147 { 156 {
148 if (!resources) { 157 if (!resources) {
149 if (m_object->style()->svgStyle().hasFilter()) 158 if (m_object->style()->svgStyle().hasFilter())
150 return false; 159 return false;
151 } else if (RenderSVGResourceFilter* filter = resources->filter()) { 160 } else if (RenderSVGResourceFilter* filter = resources->filter()) {
152 if (!filter->prepareEffect(m_object, m_paintInfo.context)) 161 GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paint Info.context);
162 if (!filterContext)
153 return false; 163 return false;
154 m_filter = filter; 164 m_filter = filter;
155 165
166 // Because the filter needs to cache its contents we replace the context
167 // during filtering with the filter's context.
168 m_paintInfo.context = filterContext;
169
156 // Because we cache the filter contents and do not invalidate on paint 170 // Because we cache the filter contents and do not invalidate on paint
157 // invalidation rect changes, we need to paint the entire filter region 171 // invalidation rect changes, we need to paint the entire filter region
158 // so elements outside the initial paint (due to scrolling, etc) paint. 172 // so elements outside the initial paint (due to scrolling, etc) paint.
159 m_paintInfo.rect = LayoutRect::infiniteIntRect(); 173 m_paintInfo.rect = LayoutRect::infiniteIntRect();
160 } 174 }
161 return true; 175 return true;
162 } 176 }
163 177
164 bool SVGRenderingContext::isIsolationInstalled() const 178 bool SVGRenderingContext::isIsolationInstalled() const
165 { 179 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 { 250 {
237 ASSERT(context); 251 ASSERT(context);
238 ASSERT(item); 252 ASSERT(item);
239 ASSERT(!item->needsLayout()); 253 ASSERT(!item->needsLayout());
240 254
241 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 255 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
242 item->paint(info, IntPoint()); 256 item->paint(info, IntPoint());
243 } 257 }
244 258
245 } // namespace blink 259 } // 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