Changeset 52865 in webkit
- Timestamp:
- Jan 6, 2010 1:10:35 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52864 r52865 1 2010-01-06 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVG feImage support 6 https://bugs.webkit.org/show_bug.cgi?id=31905 7 8 The implementation of feImage requires pixel test result updates of the already 9 available tests. 10 11 There is also an update for svg/filters/feComposite.svg, since the patch also 12 fixed a bug in feComposite. 13 14 * platform/mac/svg/W3C-SVG-1.1/filters-composite-02-b-expected.checksum: 15 * platform/mac/svg/W3C-SVG-1.1/filters-composite-02-b-expected.png: 16 * platform/mac/svg/W3C-SVG-1.1/filters-displace-01-f-expected.checksum: 17 * platform/mac/svg/W3C-SVG-1.1/filters-displace-01-f-expected.png: 18 * platform/mac/svg/W3C-SVG-1.1/filters-image-01-b-expected.checksum: 19 * platform/mac/svg/W3C-SVG-1.1/filters-image-01-b-expected.png: 20 * platform/mac/svg/custom/feDisplacementMap-01-expected.checksum: 21 * platform/mac/svg/custom/feDisplacementMap-01-expected.png: 22 * platform/mac/svg/filters/feComposite-expected.checksum: 23 * platform/mac/svg/filters/feComposite-expected.png: 24 * platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum: 25 * platform/mac/svg/webarchive/svg-feimage-subresources-expected.png: 26 1 27 2010-01-06 Darin Adler <darin@apple.com> 2 28 -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-composite-02-b-expected.checksum
r51800 r52865 1 595cf6946aa045acc21ed50e49871010 1 4e2d58b2588a2a7b8d42e789a80f789f -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-displace-01-f-expected.checksum
r51800 r52865 1 a5b60846615b1ff8ccd1bbb5062c6fe51 b6c63dd5fe1fda01e3ff9b0dfd771915 -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-image-01-b-expected.checksum
r51800 r52865 1 5a1e5687cc46137b116c062c175d83d5 1 cfb233bae17cc624073e47952c53e490 -
trunk/LayoutTests/platform/mac/svg/custom/feDisplacementMap-01-expected.checksum
r51800 r52865 1 37725a2315328ea128fc2cfe3549a4f9 1 c13733cd61a1b84ab863558aa67ee47b -
trunk/LayoutTests/platform/mac/svg/filters/feComposite-expected.checksum
r51800 r52865 1 2393c34443caa35be741e4cc3e05edd2 1 d0fabba10fec772a87a338fa3bf1b627 -
trunk/LayoutTests/platform/mac/svg/webarchive/svg-feimage-subresources-expected.checksum
r51800 r52865 1 853de00567d121bea0b7bece66a5d61c 1 c6ab9fc121db160df3116601d024db23 -
trunk/WebCore/ChangeLog
r52862 r52865 1 2010-01-06 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVG feImage support 6 https://bugs.webkit.org/show_bug.cgi?id=31905 7 8 This implements the SVG Filter effect feImage with support of fragment urls. 9 It also includes a bug fix for feComposite. feComposite didn't cover values 10 bigger than 255 correctly on composite oeprator arithmetic. 11 12 Tests: There are already many feImage tests in trunk. They just needed updated 13 pixel test results. 14 The feComposite bug is covered by svg/W3C-SVG-1.1/filters-composite-02-b.svg 15 and depends on feImage. 16 17 * platform/graphics/filters/FEComposite.cpp: 18 (WebCore::arithmetic): 19 * rendering/RenderSVGImage.cpp: 20 (WebCore::RenderSVGImage::paint): 21 * rendering/RenderSVGImage.h: 22 * svg/SVGFEImageElement.cpp: 23 (WebCore::SVGFEImageElement::requestImageResource): 24 (WebCore::SVGFEImageElement::parseMappedAttribute): 25 (WebCore::SVGFEImageElement::notifyFinished): 26 (WebCore::SVGFEImageElement::build): 27 * svg/SVGFEImageElement.h: 28 * svg/SVGFEImageElement.idl: 29 * svg/SVGPreserveAspectRatio.cpp: 30 (WebCore::SVGPreserveAspectRatio::transformRect): 31 * svg/SVGPreserveAspectRatio.h: 32 * svg/graphics/filters/SVGFEImage.cpp: 33 (WebCore::FEImage::FEImage): 34 (WebCore::FEImage::create): 35 (WebCore::FEImage::apply): 36 * svg/graphics/filters/SVGFEImage.h: 37 1 38 2010-01-06 Yong Li <yoli@rim.com> 2 39 -
trunk/WebCore/platform/graphics/filters/FEComposite.cpp
r51310 r52865 112 112 unsigned char i2 = srcPixelArrayB->get(pixelOffset + channel); 113 113 114 unsigned char result = scaledK1 * i1 * i2 + k2 * i1 + k3 * i2 + scaledK4; 115 if (channel == 3 && i1 == 0 && i2 == 0) 116 result = 0; 114 double result = scaledK1 * i1 * i2 + k2 * i1 + k3 * i2 + scaledK4; 117 115 srcPixelArrayB->set(pixelOffset + channel, result); 118 116 } -
trunk/WebCore/rendering/RenderSVGImage.cpp
r52647 r52865 49 49 } 50 50 51 void RenderSVGImage::adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& srcRect, const SVGPreserveAspectRatio& aspectRatio)52 {53 float origDestWidth = destRect.width();54 float origDestHeight = destRect.height();55 if (aspectRatio.meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET) {56 float widthToHeightMultiplier = srcRect.height() / srcRect.width();57 if (origDestHeight > (origDestWidth * widthToHeightMultiplier)) {58 destRect.setHeight(origDestWidth * widthToHeightMultiplier);59 switch (aspectRatio.align()) {60 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID:61 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:62 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:63 destRect.setY(destRect.y() + origDestHeight / 2.0f - destRect.height() / 2.0f);64 break;65 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX:66 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:67 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX:68 destRect.setY(destRect.y() + origDestHeight - destRect.height());69 break;70 }71 }72 if (origDestWidth > (origDestHeight / widthToHeightMultiplier)) {73 destRect.setWidth(origDestHeight / widthToHeightMultiplier);74 switch (aspectRatio.align()) {75 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN:76 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:77 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:78 destRect.setX(destRect.x() + origDestWidth / 2.0f - destRect.width() / 2.0f);79 break;80 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN:81 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:82 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX:83 destRect.setX(destRect.x() + origDestWidth - destRect.width());84 break;85 }86 }87 } else if (aspectRatio.meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE) {88 float widthToHeightMultiplier = srcRect.height() / srcRect.width();89 // if the destination height is less than the height of the image we'll be drawing90 if (origDestHeight < (origDestWidth * widthToHeightMultiplier)) {91 float destToSrcMultiplier = srcRect.width() / destRect.width();92 srcRect.setHeight(destRect.height() * destToSrcMultiplier);93 switch (aspectRatio.align()) {94 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID:95 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:96 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:97 srcRect.setY(destRect.y() + image()->height() / 2.0f - srcRect.height() / 2.0f);98 break;99 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX:100 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:101 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX:102 srcRect.setY(destRect.y() + image()->height() - srcRect.height());103 break;104 }105 }106 // if the destination width is less than the width of the image we'll be drawing107 if (origDestWidth < (origDestHeight / widthToHeightMultiplier)) {108 float destToSrcMultiplier = srcRect.height() / destRect.height();109 srcRect.setWidth(destRect.width() * destToSrcMultiplier);110 switch (aspectRatio.align()) {111 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN:112 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID:113 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX:114 srcRect.setX(destRect.x() + image()->width() / 2.0f - srcRect.width() / 2.0f);115 break;116 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN:117 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID:118 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX:119 srcRect.setX(destRect.x() + image()->width() - srcRect.width());120 break;121 }122 }123 }124 }125 126 51 void RenderSVGImage::layout() 127 52 { … … 166 91 SVGImageElement* imageElt = static_cast<SVGImageElement*>(node()); 167 92 if (imageElt->preserveAspectRatio().align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 168 adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio());93 imageElt->preserveAspectRatio().transformRect(destRect, srcRect); 169 94 170 95 paintInfo.context->drawImage(image(), DeviceColorSpace, destRect, srcRect); -
trunk/WebCore/rendering/RenderSVGImage.h
r52647 r52865 60 60 61 61 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); 62 void adjustRectsForAspectRatio(FloatRect& destRect, FloatRect& srcRect, const SVGPreserveAspectRatio&);63 62 64 63 virtual void layout(); -
trunk/WebCore/svg/SVGFEImageElement.cpp
r52373 r52865 2 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 2004, 2005 Rob Buis <buis@kde.org> 4 2010 Dirk Schulze <krit@webkit.org> 4 5 5 6 This library is free software; you can redistribute it and/or … … 32 33 #include "SVGNames.h" 33 34 #include "SVGPreserveAspectRatio.h" 35 #include "SVGRenderSupport.h" 34 36 #include "SVGResourceFilter.h" 35 37 … … 53 55 } 54 56 57 void SVGFEImageElement::requestImageResource() 58 { 59 if (m_cachedImage) { 60 m_cachedImage->removeClient(this); 61 m_cachedImage = 0; 62 } 63 64 Element* hrefElement = document()->getElementById(SVGURIReference::getTarget(href())); 65 if (hrefElement && hrefElement->isSVGElement() && hrefElement->renderer()) 66 return; 67 68 m_cachedImage = ownerDocument()->docLoader()->requestImage(href()); 69 70 if (m_cachedImage) 71 m_cachedImage->addClient(this); 72 } 73 55 74 void SVGFEImageElement::parseMappedAttribute(MappedAttribute* attr) 56 75 { … … 60 79 else { 61 80 if (SVGURIReference::parseMappedAttribute(attr)) { 62 if (!href().startsWith("#")) { 63 // FIXME: this code needs to special-case url fragments and later look them up using getElementById instead of loading them here 64 if (m_cachedImage) 65 m_cachedImage->removeClient(this); 66 m_cachedImage = ownerDocument()->docLoader()->requestImage(href()); 67 if (m_cachedImage) 68 m_cachedImage->addClient(this); 69 } 81 requestImageResource(); 70 82 return; 71 83 } … … 81 93 void SVGFEImageElement::notifyFinished(CachedResource*) 82 94 { 95 SVGStyledElement::invalidateResourcesInAncestorChain(); 83 96 } 84 97 85 98 bool SVGFEImageElement::build(SVGResourceFilter* filterResource) 86 99 { 87 if (!m_cachedImage) 88 return false; 100 if (!m_cachedImage && !m_targetImage) { 101 Element* hrefElement = document()->getElementById(SVGURIReference::getTarget(href())); 102 if (!hrefElement || !hrefElement->isSVGElement()) 103 return false; 89 104 90 RefPtr<FilterEffect> effect = FEImage::create(m_cachedImage.get()); 105 RenderObject* renderer = hrefElement->renderer(); 106 if (!renderer) 107 return false; 108 109 IntRect targetRect = enclosingIntRect(renderer->objectBoundingBox()); 110 m_targetImage = ImageBuffer::create(targetRect.size(), LinearRGB); 111 112 renderSubtreeToImage(m_targetImage.get(), renderer); 113 } 114 115 RefPtr<FilterEffect> effect = FEImage::create(m_targetImage ? m_targetImage->image() : m_cachedImage->image(), preserveAspectRatio()); 91 116 filterResource->addFilterEffect(this, effect.release()); 92 117 -
trunk/WebCore/svg/SVGFEImageElement.h
r49602 r52865 24 24 #if ENABLE(SVG) && ENABLE(FILTERS) 25 25 #include "CachedResourceHandle.h" 26 #include "SVGFilterPrimitiveStandardAttributes.h" 27 #include "SVGURIReference.h" 28 #include "SVGLangSpace.h" 26 #include "ImageBuffer.h" 29 27 #include "SVGExternalResourcesRequired.h" 30 28 #include "SVGFEImage.h" 29 #include "SVGFilterPrimitiveStandardAttributes.h" 30 #include "SVGLangSpace.h" 31 31 #include "SVGPreserveAspectRatio.h" 32 #include "SVGURIReference.h" 32 33 33 34 namespace WebCore { … … 49 50 50 51 private: 52 void requestImageResource(); 53 51 54 ANIMATED_PROPERTY_DECLARATIONS(SVGFEImageElement, SVGNames::feImageTagString, SVGNames::preserveAspectRatioAttrString, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) 52 55 … … 60 63 61 64 CachedResourceHandle<CachedImage> m_cachedImage; 65 OwnPtr<ImageBuffer> m_targetImage; 62 66 }; 63 67 -
trunk/WebCore/svg/SVGFEImageElement.idl
r44253 r52865 27 27 28 28 interface [Conditional=SVG&FILTERS] SVGFEImageElement : SVGElement, 29 SVGURIReference, 30 SVGLangSpace, 31 SVGExternalResourcesRequired, 32 SVGFilterPrimitiveStandardAttributes { 29 SVGURIReference, 30 SVGLangSpace, 31 SVGExternalResourcesRequired, 32 SVGFilterPrimitiveStandardAttributes { 33 readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; 33 34 }; 34 35 -
trunk/WebCore/svg/SVGPreserveAspectRatio.cpp
r52373 r52865 2 2 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 2010 Dirk Schulze <krit@webkit.org> 4 5 5 6 This library is free software; you can redistribute it and/or … … 159 160 } 160 161 162 void SVGPreserveAspectRatio::transformRect(FloatRect& destRect, FloatRect& srcRect) 163 { 164 FloatSize imageSize = srcRect.size(); 165 float origDestWidth = destRect.width(); 166 float origDestHeight = destRect.height(); 167 if (meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET) { 168 float widthToHeightMultiplier = srcRect.height() / srcRect.width(); 169 if (origDestHeight > (origDestWidth * widthToHeightMultiplier)) { 170 destRect.setHeight(origDestWidth * widthToHeightMultiplier); 171 switch (align()) { 172 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID: 173 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID: 174 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID: 175 destRect.setY(destRect.y() + origDestHeight / 2.0f - destRect.height() / 2.0f); 176 break; 177 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX: 178 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX: 179 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX: 180 destRect.setY(destRect.y() + origDestHeight - destRect.height()); 181 break; 182 } 183 } 184 if (origDestWidth > (origDestHeight / widthToHeightMultiplier)) { 185 destRect.setWidth(origDestHeight / widthToHeightMultiplier); 186 switch (align()) { 187 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN: 188 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID: 189 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX: 190 destRect.setX(destRect.x() + origDestWidth / 2.0f - destRect.width() / 2.0f); 191 break; 192 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN: 193 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID: 194 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX: 195 destRect.setX(destRect.x() + origDestWidth - destRect.width()); 196 break; 197 } 198 } 199 } else if (meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE) { 200 float widthToHeightMultiplier = srcRect.height() / srcRect.width(); 201 // if the destination height is less than the height of the image we'll be drawing 202 if (origDestHeight < (origDestWidth * widthToHeightMultiplier)) { 203 float destToSrcMultiplier = srcRect.width() / destRect.width(); 204 srcRect.setHeight(destRect.height() * destToSrcMultiplier); 205 switch (align()) { 206 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID: 207 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID: 208 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID: 209 srcRect.setY(destRect.y() + imageSize.height() / 2.0f - srcRect.height() / 2.0f); 210 break; 211 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX: 212 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX: 213 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX: 214 srcRect.setY(destRect.y() + imageSize.height() - srcRect.height()); 215 break; 216 } 217 } 218 // if the destination width is less than the width of the image we'll be drawing 219 if (origDestWidth < (origDestHeight / widthToHeightMultiplier)) { 220 float destToSrcMultiplier = srcRect.height() / destRect.height(); 221 srcRect.setWidth(destRect.width() * destToSrcMultiplier); 222 switch (align()) { 223 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN: 224 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID: 225 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX: 226 srcRect.setX(destRect.x() + imageSize.width() / 2.0f - srcRect.width() / 2.0f); 227 break; 228 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN: 229 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID: 230 case SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMAX: 231 srcRect.setX(destRect.x() + imageSize.width() - srcRect.width()); 232 break; 233 } 234 } 235 } 236 } 237 161 238 TransformationMatrix SVGPreserveAspectRatio::getCTM(double logicX, double logicY, 162 239 double logicWidth, double logicHeight, -
trunk/WebCore/svg/SVGPreserveAspectRatio.h
r52373 r52865 23 23 24 24 #if ENABLE(SVG) 25 #include "FloatRect.h" 25 26 #include "PlatformString.h" 26 27 #include "SVGNames.h" … … 61 62 void setMeetOrSlice(unsigned short); 62 63 unsigned short meetOrSlice() const; 64 65 void transformRect(FloatRect& destRect, FloatRect& srcRect); 63 66 64 67 TransformationMatrix getCTM(double logicX, double logicY, -
trunk/WebCore/svg/graphics/filters/SVGFEImage.cpp
r44655 r52865 3 3 2004, 2005 Rob Buis <buis@kde.org> 4 4 2005 Eric Seidel <eric@webkit.org> 5 2010 Dirk Schulze <krit@webkit.org> 5 6 6 7 This library is free software; you can redistribute it and/or … … 24 25 #if ENABLE(SVG) && ENABLE(FILTERS) 25 26 #include "SVGFEImage.h" 27 28 #include "Filter.h" 29 #include "GraphicsContext.h" 30 #include "SVGPreserveAspectRatio.h" 26 31 #include "SVGRenderTreeAsText.h" 27 #include " Filter.h"32 #include "TransformationMatrix.h" 28 33 29 34 namespace WebCore { 30 35 31 FEImage::FEImage( CachedImage* cachedImage)36 FEImage::FEImage(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio) 32 37 : FilterEffect() 33 , m_cachedImage(cachedImage) 38 , m_image(image) 39 , m_preserveAspectRatio(preserveAspectRatio) 34 40 { 35 m_cachedImage->addClient(this);36 41 } 37 42 38 PassRefPtr<FEImage> FEImage::create( CachedImage* cachedImage)43 PassRefPtr<FEImage> FEImage::create(RefPtr<Image> image, SVGPreserveAspectRatio preserveAspectRatio) 39 44 { 40 return adoptRef(new FEImage(cachedImage)); 41 } 42 43 FEImage::~FEImage() 44 { 45 if (m_cachedImage) 46 m_cachedImage->removeClient(this); 47 } 48 49 CachedImage* FEImage::cachedImage() const 50 { 51 return m_cachedImage.get(); 52 } 53 54 void FEImage::setCachedImage(CachedImage* image) 55 { 56 if (m_cachedImage == image) 57 return; 58 59 if (m_cachedImage) 60 m_cachedImage->removeClient(this); 61 62 m_cachedImage = image; 63 64 if (m_cachedImage) 65 m_cachedImage->addClient(this); 45 return adoptRef(new FEImage(image, preserveAspectRatio)); 66 46 } 67 47 68 48 void FEImage::apply(Filter*) 69 49 { 50 if (!m_image.get()) 51 return; 52 53 GraphicsContext* filterContext = getEffectContext(); 54 if (!filterContext) 55 return; 56 57 FloatRect srcRect(FloatPoint(), m_image->size()); 58 FloatRect destRect(FloatPoint(), subRegion().size()); 59 60 m_preserveAspectRatio.transformRect(destRect, srcRect); 61 62 filterContext->drawImage(m_image.get(), DeviceColorSpace, destRect, srcRect); 70 63 } 71 64 -
trunk/WebCore/svg/graphics/filters/SVGFEImage.h
r44655 r52865 3 3 2004, 2005 Rob Buis <buis@kde.org> 4 4 2005 Eric Seidel <eric@webkit.org> 5 2010 Dirk Schulze <krit@webkit.org> 5 6 6 7 This library is free software; you can redistribute it and/or … … 24 25 25 26 #if ENABLE(SVG) && ENABLE(FILTERS) 26 #include "CachedImage.h" 27 #include "CachedResourceClient.h" 28 #include "CachedResourceHandle.h" 27 #include "Image.h" 29 28 #include "FilterEffect.h" 30 29 #include "Filter.h" 30 #include "SVGPreserveAspectRatio.h" 31 31 32 32 namespace WebCore { 33 33 34 class FEImage : public FilterEffect 35 , public CachedResourceClient { 34 class FEImage : public FilterEffect { 36 35 public: 37 static PassRefPtr<FEImage> create(CachedImage*); 38 virtual ~FEImage(); 39 40 // FIXME: We need to support <svg> (RenderObject*) as well as image data. 41 42 CachedImage* cachedImage() const; 43 void setCachedImage(CachedImage*); 36 static PassRefPtr<FEImage> create(RefPtr<Image>, SVGPreserveAspectRatio); 44 37 45 38 void apply(Filter*); … … 48 41 49 42 private: 50 FEImage( CachedImage*);43 FEImage(RefPtr<Image>, SVGPreserveAspectRatio); 51 44 52 CachedResourceHandle<CachedImage> m_cachedImage; 45 RefPtr<Image> m_image; 46 SVGPreserveAspectRatio m_preserveAspectRatio; 53 47 }; 54 48 -
trunk/WebKitSite/ChangeLog
r52433 r52865 1 2010-01-06 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVG feImage support 6 https://bugs.webkit.org/show_bug.cgi?id=31905 7 8 Update SVG status page. We support feDisplacementMap and feImage now. 9 10 * projects/svg/status.xml: 11 1 12 2009-12-20 Chris Jerdonek <chris.jerdonek@gmail.com> 2 13 -
trunk/WebKitSite/projects/svg/status.xml
r50606 r52865 7 7 </p> 8 8 <p> 9 Last update: Nov 5th, 2009.9 Last update: Jan 5th, 2010. 10 10 </p> 11 11 <p> … … 294 294 <issue>Tracking Bug <bug>26389</bug>.</issue> 295 295 <issue>Filters look grainy when scaled <bug>5526</bug></issue> 296 <issue>Filters don't support filterRes <bug>6021</bug></issue>297 296 <issue>Need support sources other than SourceGraphic <bug>6022</bug></issue> 298 297 <issue>Support 'color-interpolation-filters' and draw in correct colorspace <bug>6033</bug></issue> … … 300 299 <issue>Handle missing filter elements correctly <bug>12569</bug></issue> 301 300 <issue>Filter Effects being cleared and reloaded multiple times <bug>19388</bug></issue> 302 <issue>Big filterRegions <bug>26380</bug></issue>303 301 </issues> 304 302 </element> … … 339 337 <name>feDisplacementMap</name> 340 338 <url>http://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement</url> 341 <status> Unimplemented</status>339 <status>Implemented</status> 342 340 </element> 343 341 <element> … … 354 352 <name>feImage</name> 355 353 <url>http://www.w3.org/TR/SVG11/filters.html#feImageElement</url> 356 <status>Unimplemented</status> 357 <issues> 358 <issue>Does not support SVG fragment URLs <bug>12027</bug></issue> 359 </issues> 354 <status>Implemented</status> 360 355 </element> 361 356 <element>
Note: See TracChangeset
for help on using the changeset viewer.