haikuwebkit/LayoutTests/svg/custom/grayscale-gradient-mask-2.svg

25 lines
1.4 KiB
XML
Raw Permalink Normal View History

SVG Mask should take 'color-interpolation' into account to determine the color space of the mask image https://bugs.webkit.org/show_bug.cgi?id=69076 Source/WebCore: Reviewed by Simon Fraser. SVG Masks should take 'color-interpolation' into account to determine the color space of the mask image. The behavior was changed in SVG 1.1 SE. The color space of the mask image gets defined by the computed value of the 'color-interpolation' property. This will switch the default color space from linearRGB to sRGB for mask images and is a performance improvement for platforms without native support for linearRGB color space. The color space transformation can be avoided. Test: svg/custom/grayscale-gradient-mask-2.svg * rendering/svg/RenderSVGResourceMasker.cpp: (WebCore::RenderSVGResourceMasker::applyResource): (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): * rendering/svg/RenderSVGResourceMasker.h: LayoutTests: Reviewed by Simon Fraser. Added a new test case to check the behavior of SVG Masks on different values for the 'color-interpolation' property. Since the default color space of the mask image changes from linearRGB to sRGB, a test needed an update. * platform/mac/svg/custom/grayscale-gradient-mask-2-expected.png: Added. * platform/mac/svg/custom/grayscale-gradient-mask-2-expected.txt: Added. * platform/mac/svg/custom/grayscale-gradient-mask-expected.png: * platform/mac/svg/custom/grayscale-gradient-mask-expected.txt: * svg/custom/grayscale-gradient-mask-2.svg: Added. Canonical link: https://commits.webkit.org/85232@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-10-02 07:15:08 +00:00
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 820 320" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Example mask01 - blue text masked with gradient against red background
</desc>
<defs>
<linearGradient id="Gradient" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="800" y2="0">
<stop offset="0" stop-color="white" stop-opacity="1"/> <!-- this end is filled -->
<stop offset="1" stop-color="black" stop-opacity="1"/>
</linearGradient>
</defs>
<mask id="Mask1" maskUnits="userSpaceOnUse" x="0" y="0" width="800" height="100">
<rect x="0" y="0" width="800" height="100" fill="url(#Gradient)"/>
</mask>
<mask id="Mask2" maskUnits="userSpaceOnUse" x="0" y="100" width="800" height="100" color-interpolation="linearRGB">
<rect x="0" y="100" width="800" height="100" fill="url(#Gradient)"/>
</mask>
<mask id="Mask3" maskUnits="userSpaceOnUse" x="0" y="200" width="800" height="100" color-interpolation="sRGB">
<rect x="0" y="200" width="800" height="100" fill="url(#Gradient)"/>
</mask>
<rect x="0" y="0" width="800" height="300" fill="#FF8080"/>
<rect x="0" y="0" width="800" height="100" fill="blue" mask="url(#Mask1)"/>
<rect x="0" y="100" width="800" height="100" fill="blue" mask="url(#Mask2)"/>
<rect x="0" y="200" width="800" height="100" fill="blue" mask="url(#Mask3)"/>
</svg>