| OLD | NEW |
| 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 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "Attr.h" | 27 #include "Attr.h" |
| 28 #include "CachedImage.h" | 28 #include "CachedImage.h" |
| 29 #include "CachedResourceLoader.h" | 29 #include "CachedResourceLoader.h" |
| 30 #include "ColorSpace.h" | 30 #include "ColorSpace.h" |
| 31 #include "Document.h" | 31 #include "Document.h" |
| 32 #include "Image.h" | 32 #include "Image.h" |
| 33 #include "RenderObject.h" | 33 #include "RenderObject.h" |
| 34 #include "RenderSVGResource.h" | 34 #include "RenderSVGResource.h" |
| 35 #include "SVGElementInstance.h" | 35 #include "SVGElementInstance.h" |
| 36 #include "SVGImageBufferTools.h" | |
| 37 #include "SVGNames.h" | 36 #include "SVGNames.h" |
| 38 #include "SVGPreserveAspectRatio.h" | 37 #include "SVGPreserveAspectRatio.h" |
| 39 | 38 |
| 40 namespace WebCore { | 39 namespace WebCore { |
| 41 | 40 |
| 42 // Animated property definitions | 41 // Animated property definitions |
| 43 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) | 42 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) |
| 44 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) | 43 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) |
| 45 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAt
tr, ExternalResourcesRequired, externalResourcesRequired) | 44 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAt
tr, ExternalResourcesRequired, externalResourcesRequired) |
| 46 | 45 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return; | 175 return; |
| 177 | 176 |
| 178 RenderSVGResource::markForLayoutAndParentResourceInvalidation(parent->render
er()); | 177 RenderSVGResource::markForLayoutAndParentResourceInvalidation(parent->render
er()); |
| 179 } | 178 } |
| 180 | 179 |
| 181 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) | 180 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) |
| 182 { | 181 { |
| 183 if (!m_cachedImage && !m_targetImage) | 182 if (!m_cachedImage && !m_targetImage) |
| 184 requestImageResource(); | 183 requestImageResource(); |
| 185 | 184 |
| 186 if (!m_cachedImage && !m_targetImage) { | 185 if (!m_cachedImage && !m_targetImage) |
| 187 Element* hrefElement = SVGURIReference::targetElementFromIRIString(href(
), document()); | 186 return FEImage::createWithIRIReference(filter, document(), href(), prese
rveAspectRatio()); |
| 188 if (!hrefElement || !hrefElement->isSVGElement()) | 187 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(rend
erer()), preserveAspectRatio()); |
| 189 return 0; | |
| 190 | |
| 191 RenderObject* renderer = hrefElement->renderer(); | |
| 192 if (!renderer) | |
| 193 return 0; | |
| 194 | |
| 195 IntRect targetRect = enclosingIntRect(renderer->objectBoundingBox()); | |
| 196 | |
| 197 if (targetRect.isEmpty()) | |
| 198 return 0; | |
| 199 | |
| 200 m_targetImage = ImageBuffer::create(targetRect.size(), ColorSpaceLinearR
GB); | |
| 201 | |
| 202 AffineTransform contentTransformation; | |
| 203 SVGImageBufferTools::renderSubtreeToImageBuffer(m_targetImage.get(), ren
derer, contentTransformation); | |
| 204 } | |
| 205 | |
| 206 return FEImage::create(filter, m_targetImage ? m_targetImage->copyImage(Copy
BackingStore) : m_cachedImage->imageForRenderer(renderer()), preserveAspectRatio
()); | |
| 207 } | 188 } |
| 208 | 189 |
| 209 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con
st | 190 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con
st |
| 210 { | 191 { |
| 211 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); | 192 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); |
| 212 | 193 |
| 213 addSubresourceURL(urls, document()->completeURL(href())); | 194 addSubresourceURL(urls, document()->completeURL(href())); |
| 214 } | 195 } |
| 215 | 196 |
| 216 } | 197 } |
| 217 | 198 |
| 218 #endif // ENABLE(SVG) | 199 #endif // ENABLE(SVG) |
| OLD | NEW |