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

Side by Side Diff: Source/core/svg/SVGFEColorMatrixElement.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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 : SVGFilterPrimitiveStandardAttributes(SVGNames::feColorMatrixTag, document) 44 : SVGFilterPrimitiveStandardAttributes(SVGNames::feColorMatrixTag, document)
45 , m_values(SVGAnimatedNumberList::create(this, SVGNames::valuesAttr, SVGNumb erList::create())) 45 , m_values(SVGAnimatedNumberList::create(this, SVGNames::valuesAttr, SVGNumb erList::create()))
46 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( ))) 46 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create( )))
47 , m_type(SVGAnimatedEnumeration<ColorMatrixType>::create(this, SVGNames::typ eAttr, FECOLORMATRIX_TYPE_MATRIX)) 47 , m_type(SVGAnimatedEnumeration<ColorMatrixType>::create(this, SVGNames::typ eAttr, FECOLORMATRIX_TYPE_MATRIX))
48 { 48 {
49 addToPropertyMap(m_values); 49 addToPropertyMap(m_values);
50 addToPropertyMap(m_in1); 50 addToPropertyMap(m_in1);
51 addToPropertyMap(m_type); 51 addToPropertyMap(m_type);
52 } 52 }
53 53
54 void SVGFEColorMatrixElement::trace(Visitor* visitor)
55 {
56 visitor->trace(m_values);
57 visitor->trace(m_in1);
58 visitor->trace(m_type);
59 SVGFilterPrimitiveStandardAttributes::trace(visitor);
60 }
61
54 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement) 62 DEFINE_NODE_FACTORY(SVGFEColorMatrixElement)
55 63
56 bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName ) 64 bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName )
57 { 65 {
58 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
59 if (supportedAttributes.isEmpty()) { 67 if (supportedAttributes.isEmpty()) {
60 supportedAttributes.add(SVGNames::typeAttr); 68 supportedAttributes.add(SVGNames::typeAttr);
61 supportedAttributes.add(SVGNames::valuesAttr); 69 supportedAttributes.add(SVGNames::valuesAttr);
62 supportedAttributes.add(SVGNames::inAttr); 70 supportedAttributes.add(SVGNames::inAttr);
63 } 71 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 104 }
97 105
98 if (attrName == SVGNames::inAttr) { 106 if (attrName == SVGNames::inAttr) {
99 invalidate(); 107 invalidate();
100 return; 108 return;
101 } 109 }
102 110
103 ASSERT_NOT_REACHED(); 111 ASSERT_NOT_REACHED();
104 } 112 }
105 113
106 PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter Builder, Filter* filter) 114 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBui lder* filterBuilder, Filter* filter)
107 { 115 {
108 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value())); 116 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
109 117
110 if (!input1) 118 if (!input1)
111 return nullptr; 119 return nullptr;
112 120
113 Vector<float> filterValues; 121 Vector<float> filterValues;
114 ColorMatrixType filterType = m_type->currentValue()->enumValue(); 122 ColorMatrixType filterType = m_type->currentValue()->enumValue();
115 123
116 // Use defaults if values is empty (SVG 1.1 15.10). 124 // Use defaults if values is empty (SVG 1.1 15.10).
117 if (!hasAttribute(SVGNames::valuesAttr)) { 125 if (!hasAttribute(SVGNames::valuesAttr)) {
118 switch (filterType) { 126 switch (filterType) {
119 case FECOLORMATRIX_TYPE_MATRIX: 127 case FECOLORMATRIX_TYPE_MATRIX:
120 for (size_t i = 0; i < 20; i++) 128 for (size_t i = 0; i < 20; i++)
121 filterValues.append((i % 6) ? 0 : 1); 129 filterValues.append((i % 6) ? 0 : 1);
122 break; 130 break;
123 case FECOLORMATRIX_TYPE_HUEROTATE: 131 case FECOLORMATRIX_TYPE_HUEROTATE:
124 filterValues.append(0); 132 filterValues.append(0);
125 break; 133 break;
126 case FECOLORMATRIX_TYPE_SATURATE: 134 case FECOLORMATRIX_TYPE_SATURATE:
127 filterValues.append(1); 135 filterValues.append(1);
128 break; 136 break;
129 default: 137 default:
130 break; 138 break;
131 } 139 }
132 } else { 140 } else {
133 RefPtr<SVGNumberList> values = m_values->currentValue(); 141 RefPtrWillBeRawPtr<SVGNumberList> values = m_values->currentValue();
134 size_t size = values->length(); 142 size_t size = values->length();
135 143
136 if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20) 144 if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
137 || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1) 145 || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1)
138 || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1)) 146 || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1))
139 return nullptr; 147 return nullptr;
140 148
141 filterValues = values->toFloatVector(); 149 filterValues = values->toFloatVector();
142 } 150 }
143 151
144 RefPtr<FilterEffect> effect = FEColorMatrix::create(filter, filterType, filt erValues); 152 RefPtrWillBeRawPtr<FilterEffect> effect = FEColorMatrix::create(filter, filt erType, filterValues);
145 effect->inputEffects().append(input1); 153 effect->inputEffects().append(input1);
146 return effect.release(); 154 return effect.release();
147 } 155 }
148 156
149 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEColorMatrixElement.h ('k') | Source/core/svg/SVGFEComponentTransferElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698