| 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 RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) | 44 RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) |
| 37 : RenderSVGResourceContainer(node) | 45 : RenderSVGResourceContainer(node) |
| 38 { | 46 { |
| 39 } | 47 } |
| 40 | 48 |
| 41 RenderSVGResourceFilter::~RenderSVGResourceFilter() | 49 RenderSVGResourceFilter::~RenderSVGResourceFilter() |
| 42 { | 50 { |
| 43 } | 51 } |
| 44 | 52 |
| 53 void RenderSVGResourceFilter::trace(Visitor* visitor) |
| 54 { |
| 55 #if ENABLE(OILPAN) |
| 56 visitor->trace(m_filter); |
| 57 #endif |
| 58 RenderSVGResourceContainer::trace(visitor); |
| 59 } |
| 60 |
| 45 void RenderSVGResourceFilter::destroy() | 61 void RenderSVGResourceFilter::destroy() |
| 46 { | 62 { |
| 47 m_filter.clear(); | 63 m_filter.clear(); |
| 48 RenderSVGResourceContainer::destroy(); | 64 RenderSVGResourceContainer::destroy(); |
| 49 } | 65 } |
| 50 | 66 |
| 51 bool RenderSVGResourceFilter::isChildAllowed(RenderObject* child, RenderStyle*)
const | 67 bool RenderSVGResourceFilter::isChildAllowed(RenderObject* child, RenderStyle*)
const |
| 52 { | 68 { |
| 53 return child->isSVGResourceFilterPrimitive(); | 69 return child->isSVGResourceFilterPrimitive(); |
| 54 } | 70 } |
| 55 | 71 |
| 56 void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation
) | 72 void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation
) |
| 57 { | 73 { |
| 58 m_filter.clear(); | 74 m_filter.clear(); |
| 59 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); | 75 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval
idation : ParentOnlyInvalidation); |
| 60 } | 76 } |
| 61 | 77 |
| 62 void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool m
arkForInvalidation) | 78 void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool m
arkForInvalidation) |
| 63 { | 79 { |
| 64 ASSERT(client); | 80 ASSERT(client); |
| 65 | 81 |
| 66 m_filter.remove(client); | 82 m_filter.remove(client); |
| 67 | 83 |
| 68 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); | 84 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati
on : ParentOnlyInvalidation); |
| 69 } | 85 } |
| 70 | 86 |
| 71 PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives(SVGFilter*
filter) | 87 PassRefPtrWillBeRawPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitive
s(SVGFilter* filter) |
| 72 { | 88 { |
| 73 SVGFilterElement* filterElement = toSVGFilterElement(element()); | 89 SVGFilterElement* filterElement = toSVGFilterElement(element()); |
| 74 FloatRect targetBoundingBox = filter->targetBoundingBox(); | 90 FloatRect targetBoundingBox = filter->targetBoundingBox(); |
| 75 | 91 |
| 76 // Add effects to the builder | 92 // Add effects to the builder |
| 77 RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(SourceGraphic::c
reate(filter), SourceAlpha::create(filter)); | 93 RefPtrWillBeRawPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(Sour
ceGraphic::create(filter), SourceAlpha::create(filter)); |
| 78 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement)
; element; element = Traversal<SVGElement>::nextSibling(*element)) { | 94 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement)
; element; element = Traversal<SVGElement>::nextSibling(*element)) { |
| 79 if (!element->isFilterEffect() || !element->renderer()) | 95 if (!element->isFilterEffect() || !element->renderer()) |
| 80 continue; | 96 continue; |
| 81 | 97 |
| 82 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); | 98 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); |
| 83 RefPtr<FilterEffect> effect = effectElement->build(builder.get(), filter
); | 99 RefPtrWillBeRawPtr<FilterEffect> effect = effectElement->build(builder.g
et(), filter); |
| 84 if (!effect) { | 100 if (!effect) { |
| 85 builder->clearEffects(); | 101 builder->clearEffects(); |
| 86 return nullptr; | 102 return nullptr; |
| 87 } | 103 } |
| 88 builder->appendEffectToEffectReferences(effect, effectElement->renderer(
)); | 104 builder->appendEffectToEffectReferences(effect, effectElement->renderer(
)); |
| 89 effectElement->setStandardAttributes(effect.get()); | 105 effectElement->setStandardAttributes(effect.get()); |
| 90 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur
rentValue()->enumValue(), targetBoundingBox)); | 106 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur
rentValue()->enumValue(), targetBoundingBox)); |
| 91 effect->setOperatingColorSpace( | 107 effect->setOperatingColorSpace( |
| 92 effectElement->renderer()->style()->svgStyle().colorInterpolationFil
ters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); | 108 effectElement->renderer()->style()->svgStyle().colorInterpolationFil
ters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); |
| 93 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); | 109 builder->add(AtomicString(effectElement->result()->currentValue()->value
()), effect); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 201 |
| 186 clearInvalidationMask(); | 202 clearInvalidationMask(); |
| 187 | 203 |
| 188 if (m_filter.contains(object)) { | 204 if (m_filter.contains(object)) { |
| 189 FilterData* filterData = m_filter.get(object); | 205 FilterData* filterData = m_filter.get(object); |
| 190 if (filterData->state == FilterData::PaintingSource) | 206 if (filterData->state == FilterData::PaintingSource) |
| 191 filterData->state = FilterData::CycleDetected; | 207 filterData->state = FilterData::CycleDetected; |
| 192 return false; // Already built, or we're in a cycle. Regardless, just do
nothing more now. | 208 return false; // Already built, or we're in a cycle. Regardless, just do
nothing more now. |
| 193 } | 209 } |
| 194 | 210 |
| 195 OwnPtr<FilterData> filterData(adoptPtr(new FilterData)); | 211 OwnPtrWillBeRawPtr<FilterData> filterData = FilterData::create(); |
| 196 FloatRect targetBoundingBox = object->objectBoundingBox(); | 212 FloatRect targetBoundingBox = object->objectBoundingBox(); |
| 197 | 213 |
| 198 SVGFilterElement* filterElement = toSVGFilterElement(element()); | 214 SVGFilterElement* filterElement = toSVGFilterElement(element()); |
| 199 filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement
>(filterElement, filterElement->filterUnits()->currentValue()->enumValue(), targ
etBoundingBox); | 215 filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement
>(filterElement, filterElement->filterUnits()->currentValue()->enumValue(), targ
etBoundingBox); |
| 200 if (filterData->boundaries.isEmpty()) | 216 if (filterData->boundaries.isEmpty()) |
| 201 return false; | 217 return false; |
| 202 | 218 |
| 203 filterData->drawingRegion = object->strokeBoundingBox(); | 219 filterData->drawingRegion = object->strokeBoundingBox(); |
| 204 filterData->drawingRegion.intersect(filterData->boundaries); | 220 filterData->drawingRegion.intersect(filterData->boundaries); |
| 205 IntRect intDrawingRegion = enclosingIntRect(filterData->drawingRegion); | 221 IntRect intDrawingRegion = enclosingIntRect(filterData->drawingRegion); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 markAllClientLayersForInvalidation(); | 305 markAllClientLayersForInvalidation(); |
| 290 } | 306 } |
| 291 | 307 |
| 292 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const | 308 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const |
| 293 { | 309 { |
| 294 FilterData* filterData = m_filter.get(object); | 310 FilterData* filterData = m_filter.get(object); |
| 295 return filterData ? filterData->drawingRegion : FloatRect(); | 311 return filterData ? filterData->drawingRegion : FloatRect(); |
| 296 } | 312 } |
| 297 | 313 |
| 298 } | 314 } |
| OLD | NEW |