OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #include "core/dom/ElementTraversal.h" | 27 #include "core/dom/ElementTraversal.h" |
28 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" | 28 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" |
29 #include "platform/graphics/GraphicsContext.h" | 29 #include "platform/graphics/GraphicsContext.h" |
30 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 30 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
31 #include "platform/graphics/filters/SourceAlpha.h" | 31 #include "platform/graphics/filters/SourceAlpha.h" |
32 #include "platform/graphics/filters/SourceGraphic.h" | 32 #include "platform/graphics/filters/SourceGraphic.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
| 36 void FilterData::trace(Visitor* visitor) |
| 37 { |
| 38 #if ENABLE(OILPAN) |
| 39 visitor->trace(filter); |
| 40 visitor->trace(builder); |
| 41 #endif |
| 42 } |
| 43 |
36 const RenderSVGResourceType RenderSVGResourceFilter::s_resourceType = FilterReso
urceType; | 44 const RenderSVGResourceType RenderSVGResourceFilter::s_resourceType = FilterReso
urceType; |
37 | 45 |
38 RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) | 46 RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) |
39 : RenderSVGResourceContainer(node) | 47 : RenderSVGResourceContainer(node) |
40 { | 48 { |
41 } | 49 } |
42 | 50 |
43 RenderSVGResourceFilter::~RenderSVGResourceFilter() | 51 RenderSVGResourceFilter::~RenderSVGResourceFilter() |
44 { | 52 { |
45 } | 53 } |
46 | 54 |
| 55 void RenderSVGResourceFilter::trace(Visitor* visitor) |
| 56 { |
| 57 #if ENABLE(OILPAN) |
| 58 visitor->trace(m_filter); |
| 59 #endif |
| 60 RenderSVGResourceContainer::trace(visitor); |
| 61 } |
| 62 |
47 void RenderSVGResourceFilter::destroy() | 63 void RenderSVGResourceFilter::destroy() |
48 { | 64 { |
49 m_filter.clear(); | 65 m_filter.clear(); |
50 RenderSVGResourceContainer::destroy(); | 66 RenderSVGResourceContainer::destroy(); |
51 } | 67 } |
52 | 68 |
53 bool RenderSVGResourceFilter::isChildAllowed(RenderObject* child, RenderStyle*)
const | 69 bool RenderSVGResourceFilter::isChildAllowed(RenderObject* child, RenderStyle*)
const |
54 { | 70 { |
55 return child->isSVGResourceFilterPrimitive(); | 71 return child->isSVGResourceFilterPrimitive(); |
56 } | 72 } |
57 | 73 |
58 void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation
) | 74 void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation
) |
59 { | 75 { |
60 m_filter.clear(); | 76 m_filter.clear(); |
61 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); | 77 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); |
62 } | 78 } |
63 | 79 |
64 void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool m
arkForInvalidation) | 80 void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool m
arkForInvalidation) |
65 { | 81 { |
66 ASSERT(client); | 82 ASSERT(client); |
67 | 83 |
68 m_filter.remove(client); | 84 m_filter.remove(client); |
69 | 85 |
70 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 86 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
71 } | 87 } |
72 | 88 |
73 PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter*
filter) | 89 PassRefPtrWillBeRawPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitive
s(SVGFilter* filter) |
74 { | 90 { |
75 SVGFilterElement* filterElement = toSVGFilterElement(element()); | 91 SVGFilterElement* filterElement = toSVGFilterElement(element()); |
76 FloatRect targetBoundingBox = filter->targetBoundingBox(); | 92 FloatRect targetBoundingBox = filter->targetBoundingBox(); |
77 | 93 |
78 // Add effects to the builder | 94 // Add effects to the builder |
79 RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(SourceGraphic::c
reate(filter), SourceAlpha::create(filter)); | 95 RefPtrWillBeRawPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(Sour
ceGraphic::create(filter), SourceAlpha::create(filter)); |
80 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement)
; element; element = Traversal<SVGElement>::nextSibling(*element)) { | 96 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement)
; element; element = Traversal<SVGElement>::nextSibling(*element)) { |
81 if (!element->isFilterEffect() || !element->renderer()) | 97 if (!element->isFilterEffect() || !element->renderer()) |
82 continue; | 98 continue; |
83 | 99 |
84 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); | 100 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); |
85 RefPtr<FilterEffect> effect = effectElement->build(builder.get(), filter
); | 101 RefPtrWillBeRawPtr<FilterEffect> effect = effectElement->build(builder.g
et(), filter); |
86 if (!effect) { | 102 if (!effect) { |
87 builder->clearEffects(); | 103 builder->clearEffects(); |
88 return nullptr; | 104 return nullptr; |
89 } | 105 } |
90 builder->appendEffectToEffectReferences(effect, effectElement->renderer(
)); | 106 builder->appendEffectToEffectReferences(effect, effectElement->renderer(
)); |
91 effectElement->setStandardAttributes(effect.get()); | 107 effectElement->setStandardAttributes(effect.get()); |
92 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur
rentValue()->enumValue(), targetBoundingBox)); | 108 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur
rentValue()->enumValue(), targetBoundingBox)); |
93 effect->setOperatingColorSpace( | 109 effect->setOperatingColorSpace( |
94 effectElement->renderer()->style()->svgStyle().colorInterpolationFil
ters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); | 110 effectElement->renderer()->style()->svgStyle().colorInterpolationFil
ters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); |
95 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); | 111 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 203 |
188 clearInvalidationMask(); | 204 clearInvalidationMask(); |
189 | 205 |
190 if (m_filter.contains(object)) { | 206 if (m_filter.contains(object)) { |
191 FilterData* filterData = m_filter.get(object); | 207 FilterData* filterData = m_filter.get(object); |
192 if (filterData->state == FilterData::PaintingSource) | 208 if (filterData->state == FilterData::PaintingSource) |
193 filterData->state = FilterData::CycleDetected; | 209 filterData->state = FilterData::CycleDetected; |
194 return false; // Already built, or we're in a cycle. Regardless, just do
nothing more now. | 210 return false; // Already built, or we're in a cycle. Regardless, just do
nothing more now. |
195 } | 211 } |
196 | 212 |
197 OwnPtr<FilterData> filterData(adoptPtr(new FilterData)); | 213 OwnPtrWillBeRawPtr<FilterData> filterData = FilterData::create(); |
198 FloatRect targetBoundingBox = object->objectBoundingBox(); | 214 FloatRect targetBoundingBox = object->objectBoundingBox(); |
199 | 215 |
200 SVGFilterElement* filterElement = toSVGFilterElement(element()); | 216 SVGFilterElement* filterElement = toSVGFilterElement(element()); |
201 filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement
>(filterElement, filterElement->filterUnits()->currentValue()->enumValue(), targ
etBoundingBox); | 217 filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement
>(filterElement, filterElement->filterUnits()->currentValue()->enumValue(), targ
etBoundingBox); |
202 if (filterData->boundaries.isEmpty()) | 218 if (filterData->boundaries.isEmpty()) |
203 return false; | 219 return false; |
204 | 220 |
205 filterData->drawingRegion = object->strokeBoundingBox(); | 221 filterData->drawingRegion = object->strokeBoundingBox(); |
206 filterData->drawingRegion.intersect(filterData->boundaries); | 222 filterData->drawingRegion.intersect(filterData->boundaries); |
207 IntRect intDrawingRegion = enclosingIntRect(filterData->drawingRegion); | 223 IntRect intDrawingRegion = enclosingIntRect(filterData->drawingRegion); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 markAllClientLayersForInvalidation(); | 307 markAllClientLayersForInvalidation(); |
292 } | 308 } |
293 | 309 |
294 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const | 310 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const |
295 { | 311 { |
296 FilterData* filterData = m_filter.get(object); | 312 FilterData* filterData = m_filter.get(object); |
297 return filterData ? filterData->drawingRegion : FloatRect(); | 313 return filterData ? filterData->drawingRegion : FloatRect(); |
298 } | 314 } |
299 | 315 |
300 } | 316 } |
OLD | NEW |