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

Side by Side Diff: Source/core/layout/svg/LayoutSVGResourceFilter.cpp

Issue 1326183002: Merge ReferenceFilter into Filter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Touchups; Rebase. Created 5 years, 3 months 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
« no previous file with comments | « no previous file | Source/core/layout/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // If the filter has a cached subtree, invalidate the associated display ite m. 95 // If the filter has a cached subtree, invalidate the associated display ite m.
96 if (markForInvalidation && filterCached) 96 if (markForInvalidation && filterCached)
97 markClientForInvalidation(client, PaintInvalidation); 97 markClientForInvalidation(client, PaintInvalidation);
98 98
99 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation); 99 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation);
100 } 100 }
101 101
102 PassRefPtrWillBeRawPtr<SVGFilterBuilder> LayoutSVGResourceFilter::buildPrimitive s(SVGFilter* filter) 102 PassRefPtrWillBeRawPtr<SVGFilterBuilder> LayoutSVGResourceFilter::buildPrimitive s(SVGFilter* filter)
103 { 103 {
104 SVGFilterElement* filterElement = toSVGFilterElement(element()); 104 SVGFilterElement* filterElement = toSVGFilterElement(element());
105 FloatRect targetBoundingBox = filter->targetBoundingBox(); 105 FloatRect referenceBox = filter->referenceBox();
106 106
107 // Add effects to the builder 107 // Add effects to the builder
108 RefPtrWillBeRawPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(Sour ceGraphic::create(filter)); 108 RefPtrWillBeRawPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(filt er->sourceGraphic());
109 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement) ; element; element = Traversal<SVGElement>::nextSibling(*element)) { 109 for (SVGElement* element = Traversal<SVGElement>::firstChild(*filterElement) ; element; element = Traversal<SVGElement>::nextSibling(*element)) {
110 if (!element->isFilterEffect() || !element->layoutObject()) 110 if (!element->isFilterEffect() || !element->layoutObject())
111 continue; 111 continue;
112 112
113 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil terPrimitiveStandardAttributes*>(element); 113 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil terPrimitiveStandardAttributes*>(element);
114 RefPtrWillBeRawPtr<FilterEffect> effect = effectElement->build(builder.g et(), filter); 114 RefPtrWillBeRawPtr<FilterEffect> effect = effectElement->build(builder.g et(), filter);
115 if (!effect) { 115 if (!effect) {
116 builder->clearEffects(); 116 builder->clearEffects();
117 return nullptr; 117 return nullptr;
118 } 118 }
119 builder->appendEffectToEffectReferences(effect, effectElement->layoutObj ect()); 119 builder->appendEffectToEffectReferences(effect, effectElement->layoutObj ect());
120 effectElement->setStandardAttributes(effect.get()); 120 effectElement->setStandardAttributes(effect.get());
121 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur rentValue()->enumValue(), targetBoundingBox)); 121 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur rentValue()->enumValue(), referenceBox));
122 effect->setOperatingColorSpace( 122 effect->setOperatingColorSpace(
123 effectElement->layoutObject()->style()->svgStyle().colorInterpolatio nFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); 123 effectElement->layoutObject()->style()->svgStyle().colorInterpolatio nFilters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
124 builder->add(AtomicString(effectElement->result()->currentValue()->value ()), effect); 124 builder->add(AtomicString(effectElement->result()->currentValue()->value ()), effect);
125 } 125 }
126 filter->setLastEffect(builder->lastEffect());
126 return builder.release(); 127 return builder.release();
127 } 128 }
128 129
129 FloatRect LayoutSVGResourceFilter::resourceBoundingBox(const LayoutObject* objec t) 130 FloatRect LayoutSVGResourceFilter::resourceBoundingBox(const LayoutObject* objec t)
130 { 131 {
131 if (SVGFilterElement* element = toSVGFilterElement(this->element())) 132 if (SVGFilterElement* element = toSVGFilterElement(this->element()))
132 return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, ele ment->filterUnits()->currentValue()->enumValue(), object->objectBoundingBox()); 133 return SVGLengthContext::resolveRectangle<SVGFilterElement>(element, ele ment->filterUnits()->currentValue()->enumValue(), object->objectBoundingBox());
133 134
134 return FloatRect(); 135 return FloatRect();
135 } 136 }
(...skipping 19 matching lines...) Expand all
155 return; 156 return;
156 builder->clearResultsRecursive(effect); 157 builder->clearResultsRecursive(effect);
157 158
158 // Issue paint invalidations for the image on the screen. 159 // Issue paint invalidations for the image on the screen.
159 markClientForInvalidation(it->key, PaintInvalidation); 160 markClientForInvalidation(it->key, PaintInvalidation);
160 } 161 }
161 markAllClientLayersForInvalidation(); 162 markAllClientLayersForInvalidation();
162 } 163 }
163 164
164 } // namespace blink 165 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698