OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Inc. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Apple Inc. All rights reserved. | 4 * Copyright (C) 2011 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 case CI_LINEARRGB: | 102 case CI_LINEARRGB: |
103 cs = ColorSpaceLinearRGB; | 103 cs = ColorSpaceLinearRGB; |
104 break; | 104 break; |
105 default: | 105 default: |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 return true; | 109 return true; |
110 } | 110 } |
111 | 111 |
112 PassRefPtr<FilterEffect> ReferenceFilterBuilder::build(Filter* parentFilter, Ren
derObject* renderer, FilterEffect* previousEffect, const ReferenceFilterOperatio
n* filterOperation) | 112 PassRefPtrWillBeRawPtr<FilterEffect> ReferenceFilterBuilder::build(Filter* paren
tFilter, RenderObject* renderer, FilterEffect* previousEffect, const ReferenceFi
lterOperation* filterOperation) |
113 { | 113 { |
114 if (!renderer) | 114 if (!renderer) |
115 return nullptr; | 115 return nullptr; |
116 | 116 |
117 TreeScope* treeScope = &renderer->node()->treeScope(); | 117 TreeScope* treeScope = &renderer->node()->treeScope(); |
118 | 118 |
119 if (DocumentResourceReference* documentResourceRef = documentResourceReferen
ce(filterOperation)) { | 119 if (DocumentResourceReference* documentResourceRef = documentResourceReferen
ce(filterOperation)) { |
120 DocumentResource* cachedSVGDocument = documentResourceRef->document(); | 120 DocumentResource* cachedSVGDocument = documentResourceRef->document(); |
121 | 121 |
122 // If we have an SVG document, this is an external reference. Otherwise | 122 // If we have an SVG document, this is an external reference. Otherwise |
(...skipping 17 matching lines...) Expand all Loading... |
140 if (!isSVGFilterElement(*filter)) | 140 if (!isSVGFilterElement(*filter)) |
141 return nullptr; | 141 return nullptr; |
142 | 142 |
143 SVGFilterElement& filterElement = toSVGFilterElement(*filter); | 143 SVGFilterElement& filterElement = toSVGFilterElement(*filter); |
144 | 144 |
145 // FIXME: Figure out what to do with SourceAlpha. Right now, we're | 145 // FIXME: Figure out what to do with SourceAlpha. Right now, we're |
146 // using the alpha of the original input layer, which is obviously | 146 // using the alpha of the original input layer, which is obviously |
147 // wrong. We should probably be extracting the alpha from the | 147 // wrong. We should probably be extracting the alpha from the |
148 // previousEffect, but this requires some more processing. | 148 // previousEffect, but this requires some more processing. |
149 // This may need a spec clarification. | 149 // This may need a spec clarification. |
150 RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect,
SourceAlpha::create(parentFilter)); | 150 RefPtrWillBeRawPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(prev
iousEffect, SourceAlpha::create(parentFilter)); |
151 | 151 |
152 ColorSpace filterColorSpace = ColorSpaceDeviceRGB; | 152 ColorSpace filterColorSpace = ColorSpaceDeviceRGB; |
153 bool useFilterColorSpace = getSVGElementColorSpace(&filterElement, filterCol
orSpace); | 153 bool useFilterColorSpace = getSVGElementColorSpace(&filterElement, filterCol
orSpace); |
154 | 154 |
155 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement);
element; element = Traversal<SVGElement>::nextSibling(*element)) { | 155 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement);
element; element = Traversal<SVGElement>::nextSibling(*element)) { |
156 if (!element->isFilterEffect()) | 156 if (!element->isFilterEffect()) |
157 continue; | 157 continue; |
158 | 158 |
159 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); | 159 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); |
160 | 160 |
161 RefPtr<FilterEffect> effect = effectElement->build(builder.get(), parent
Filter); | 161 RefPtrWillBeRawPtr<FilterEffect> effect = effectElement->build(builder.g
et(), parentFilter); |
162 if (!effect) | 162 if (!effect) |
163 continue; | 163 continue; |
164 | 164 |
165 effectElement->setStandardAttributes(effect.get()); | 165 effectElement->setStandardAttributes(effect.get()); |
166 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr
entValue()->enumValue(), parentFilter->sourceImageRect())); | 166 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr
entValue()->enumValue(), parentFilter->sourceImageRect())); |
167 ColorSpace colorSpace = filterColorSpace; | 167 ColorSpace colorSpace = filterColorSpace; |
168 if (useFilterColorSpace || getSVGElementColorSpace(effectElement, colorS
pace)) | 168 if (useFilterColorSpace || getSVGElementColorSpace(effectElement, colorS
pace)) |
169 effect->setOperatingColorSpace(colorSpace); | 169 effect->setOperatingColorSpace(colorSpace); |
170 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); | 170 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); |
171 } | 171 } |
172 return builder->lastEffect(); | 172 return builder->lastEffect(); |
173 } | 173 } |
174 | 174 |
175 } // namespace blink | 175 } // namespace blink |
OLD | NEW |