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

Side by Side Diff: Source/core/paint/SVGPaintContext.cpp

Issue 1034683002: [S.P.] Use LayoutObject references in SVGFilterPainter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/paint/SVGFilterPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 namespace blink { 40 namespace blink {
41 41
42 SVGPaintContext::~SVGPaintContext() 42 SVGPaintContext::~SVGPaintContext()
43 { 43 {
44 if (m_filter) { 44 if (m_filter) {
45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
46 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter); 46 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter);
47 47
48 LayoutObjectDrawingRecorder recorder(m_originalPaintInfo->context, *m_ob ject, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect()); 48 LayoutObjectDrawingRecorder recorder(m_originalPaintInfo->context, *m_ob ject, DisplayItem::SVGFilter, LayoutRect::infiniteIntRect());
49 if (!recorder.canUseCachedDrawing()) 49 if (!recorder.canUseCachedDrawing())
50 SVGFilterPainter(*m_filter).finishEffect(m_object, m_originalPaintIn fo->context); 50 SVGFilterPainter(*m_filter).finishEffect(*m_object, m_originalPaintI nfo->context);
51 51
52 // Reset the paint info after the filter effect has been completed. 52 // Reset the paint info after the filter effect has been completed.
53 // This isn't strictly required (e.g., m_paintInfo.rect is not used 53 // This isn't strictly required (e.g., m_paintInfo.rect is not used
54 // after this). 54 // after this).
55 m_paintInfo.context = m_originalPaintInfo->context; 55 m_paintInfo.context = m_originalPaintInfo->context;
56 m_paintInfo.rect = m_originalPaintInfo->rect; 56 m_paintInfo.rect = m_originalPaintInfo->rect;
57 } 57 }
58 58
59 if (m_masker) { 59 if (m_masker) {
60 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 60 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return true; 153 return true;
154 } 154 }
155 155
156 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) 156 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources)
157 { 157 {
158 if (!resources) { 158 if (!resources) {
159 if (m_object->style()->svgStyle().hasFilter()) 159 if (m_object->style()->svgStyle().hasFilter())
160 return false; 160 return false;
161 } else if (LayoutSVGResourceFilter* filter = resources->filter()) { 161 } else if (LayoutSVGResourceFilter* filter = resources->filter()) {
162 m_filter = filter; 162 m_filter = filter;
163 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect (m_object, m_paintInfo.context); 163 GraphicsContext* filterContext = SVGFilterPainter(*filter).prepareEffect (*m_object, m_paintInfo.context);
164 if (!filterContext) 164 if (!filterContext)
165 return false; 165 return false;
166 166
167 // Because the filter needs to cache its contents we replace the context 167 // Because the filter needs to cache its contents we replace the context
168 // during filtering with the filter's context. 168 // during filtering with the filter's context.
169 m_paintInfo.context = filterContext; 169 m_paintInfo.context = filterContext;
170 170
171 // Because we cache the filter contents and do not invalidate on paint 171 // Because we cache the filter contents and do not invalidate on paint
172 // invalidation rect changes, we need to paint the entire filter region 172 // invalidation rect changes, we need to paint the entire filter region
173 // so elements outside the initial paint (due to scrolling, etc) paint. 173 // so elements outside the initial paint (due to scrolling, etc) paint.
(...skipping 17 matching lines...) Expand all
191 { 191 {
192 ASSERT(context); 192 ASSERT(context);
193 ASSERT(item); 193 ASSERT(item);
194 ASSERT(!item->needsLayout()); 194 ASSERT(!item->needsLayout());
195 195
196 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 196 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
197 item->paint(info, IntPoint()); 197 item->paint(info, IntPoint());
198 } 198 }
199 199
200 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/SVGFilterPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698