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

Side by Side Diff: Source/core/svg/graphics/filters/SVGFilterBuilder.cpp

Issue 678163002: Oilpan: move SVG property hierarchy to the heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased upto r185213 Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "config.h" 20 #include "config.h"
21 #include "core/svg/graphics/filters/SVGFilterBuilder.h" 21 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
22 22
23 #include "platform/graphics/filters/SourceAlpha.h" 23 #include "platform/graphics/filters/SourceAlpha.h"
24 #include "platform/graphics/filters/SourceGraphic.h" 24 #include "platform/graphics/filters/SourceGraphic.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 SVGFilterBuilder::SVGFilterBuilder(PassRefPtr<FilterEffect> sourceGraphic, PassR efPtr<FilterEffect> sourceAlpha) 28 SVGFilterBuilder::SVGFilterBuilder(PassRefPtrWillBeRawPtr<FilterEffect> sourceGr aphic, PassRefPtrWillBeRawPtr<FilterEffect> sourceAlpha)
29 { 29 {
30 m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic); 30 m_builtinEffects.add(SourceGraphic::effectName(), sourceGraphic);
31 m_builtinEffects.add(SourceAlpha::effectName(), sourceAlpha); 31 m_builtinEffects.add(SourceAlpha::effectName(), sourceAlpha);
32 addBuiltinEffects(); 32 addBuiltinEffects();
33 } 33 }
34 34
35 void SVGFilterBuilder::add(const AtomicString& id, PassRefPtr<FilterEffect> effe ct) 35 void SVGFilterBuilder::trace(Visitor* visitor)
36 {
37 #if ENABLE(OILPAN)
38 visitor->trace(m_builtinEffects);
39 visitor->trace(m_namedEffects);
40 visitor->trace(m_effectRenderer);
41 visitor->trace(m_effectReferences);
42 visitor->trace(m_lastEffect);
43 #endif
44 }
45
46 void SVGFilterBuilder::add(const AtomicString& id, PassRefPtrWillBeRawPtr<Filter Effect> effect)
36 { 47 {
37 if (id.isEmpty()) { 48 if (id.isEmpty()) {
38 m_lastEffect = effect; 49 m_lastEffect = effect;
39 return; 50 return;
40 } 51 }
41 52
42 if (m_builtinEffects.contains(id)) 53 if (m_builtinEffects.contains(id))
43 return; 54 return;
44 55
45 m_lastEffect = effect; 56 m_lastEffect = effect;
46 m_namedEffects.set(id, m_lastEffect); 57 m_namedEffects.set(id, m_lastEffect);
47 } 58 }
48 59
49 FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const 60 FilterEffect* SVGFilterBuilder::getEffectById(const AtomicString& id) const
50 { 61 {
51 if (!id.isEmpty()) { 62 if (!id.isEmpty()) {
52 if (FilterEffect* builtinEffect = m_builtinEffects.get(id)) 63 if (FilterEffect* builtinEffect = m_builtinEffects.get(id))
53 return builtinEffect; 64 return builtinEffect;
54 65
55 if (FilterEffect* namedEffect = m_namedEffects.get(id)) 66 if (FilterEffect* namedEffect = m_namedEffects.get(id))
56 return namedEffect; 67 return namedEffect;
57 } 68 }
58 69
59 if (m_lastEffect) 70 if (m_lastEffect)
60 return m_lastEffect.get(); 71 return m_lastEffect.get();
61 72
62 return m_builtinEffects.get(SourceGraphic::effectName()); 73 return m_builtinEffects.get(SourceGraphic::effectName());
63 } 74 }
64 75
65 void SVGFilterBuilder::appendEffectToEffectReferences(PassRefPtr<FilterEffect> p rpEffect, RenderObject* object) 76 void SVGFilterBuilder::appendEffectToEffectReferences(PassRefPtrWillBeRawPtr<Fil terEffect> prpEffect, RenderObject* object)
66 { 77 {
67 RefPtr<FilterEffect> effect = prpEffect; 78 RefPtrWillBeRawPtr<FilterEffect> effect = prpEffect;
68 79
69 // The effect must be a newly created filter effect. 80 // The effect must be a newly created filter effect.
70 ASSERT(!m_effectReferences.contains(effect)); 81 ASSERT(!m_effectReferences.contains(effect));
71 ASSERT(object && !m_effectRenderer.contains(object)); 82 ASSERT(object && !m_effectRenderer.contains(object));
72 m_effectReferences.add(effect, FilterEffectSet()); 83 m_effectReferences.add(effect, FilterEffectSet());
73 84
74 unsigned numberOfInputEffects = effect->inputEffects().size(); 85 unsigned numberOfInputEffects = effect->inputEffects().size();
75 86
76 // It is not possible to add the same value to a set twice. 87 // It is not possible to add the same value to a set twice.
77 for (unsigned i = 0; i < numberOfInputEffects; ++i) 88 for (unsigned i = 0; i < numberOfInputEffects; ++i)
(...skipping 10 matching lines...) Expand all
88 addBuiltinEffects(); 99 addBuiltinEffects();
89 } 100 }
90 101
91 void SVGFilterBuilder::clearResultsRecursive(FilterEffect* effect) 102 void SVGFilterBuilder::clearResultsRecursive(FilterEffect* effect)
92 { 103 {
93 if (!effect->hasImageFilter()) 104 if (!effect->hasImageFilter())
94 return; 105 return;
95 106
96 effect->clearResult(); 107 effect->clearResult();
97 108
98 HashSet<FilterEffect*>& effectReferences = this->effectReferences(effect); 109 FilterEffectSet& effectReferences = this->effectReferences(effect);
99 HashSet<FilterEffect*>::iterator end = effectReferences.end(); 110 FilterEffectSet::iterator end = effectReferences.end();
100 for (HashSet<FilterEffect*>::iterator it = effectReferences.begin(); it != e nd; ++it) 111 for (FilterEffectSet::iterator it = effectReferences.begin(); it != end; ++i t)
101 clearResultsRecursive(*it); 112 clearResultsRecursive(*it);
102 } 113 }
103 114
104 } // namespace blink 115 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/graphics/filters/SVGFilterBuilder.h ('k') | Source/core/svg/properties/SVGAnimatedProperty.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698