Skip to content
  • fmalita@chromium.org's avatar
    WebKit+SVG does not support color-interpolation-filters or draw filters in correct colorspace · fd7cfc7f
    fmalita@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=6033
    
    Reviewed by Dirk Schulze.
    
    Source/WebCore:
    
    This patch adds support for SVG color-interpolation-filters. All non-CG plarforms now
    perform color space conversions as needed (CG performs color space adjustments internally),
    and the new default color space for filters is linearRGB
    (http://www.w3.org/TR/SVG/filters.html#FilterPrimitivesOverviewIntro).
    
    FilterEffect tracks the color-interpolation-filters attribute (m_colorSpace) and the
    current result color space (m_resultColorSpace). When applying, the input results are
    converted to the current FilterEffect's color space, and at the end of the filter effect
    chain the result is finally converted to ColorSpaceDeviceRGB.
    
    FilterEffect::transformResultColorSpace() handles non-CG color space converion (CG has
    built in support for different color spaces) by first converting the result to an image
    buffer, and then using the platform specific ImageBuffer::transformColorSpace(). This can
    be expensive for filter chains with alternating color-interpolation-filters, but can be
    optimized if/when color space support is added to all the graphics backends similarly to CG.
    
    As expected, lots of filter-related pixel results will require rebaselining after this lands.
    
    Test: svg/filters/color-interpolation-filters.svg
    
    * platform/graphics/filters/FilterEffect.cpp:
    (WebCore::FilterEffect::FilterEffect):
    (WebCore::FilterEffect::apply):
    (WebCore::FilterEffect::asImageBuffer):
    (WebCore::FilterEffect::createImageBufferResult):
    (WebCore::FilterEffect::transformResultColorSpace):
    (WebCore):
    * platform/graphics/filters/FilterEffect.h:
    (WebCore::FilterEffect::colorSpace):
    (WebCore::FilterEffect::setColorSpace):
    (FilterEffect):
    * platform/graphics/filters/SourceGraphic.h:
    (WebCore::SourceGraphic::SourceGraphic):
    * rendering/FilterEffectRenderer.cpp:
    (WebCore::FilterEffectRenderer::apply):
    * rendering/svg/RenderSVGResourceFilter.cpp:
    (WebCore::RenderSVGResourceFilter::buildPrimitives):
    (WebCore::RenderSVGResourceFilter::postApplyResource):
    
    LayoutTests:
    
    * platform/chromium-linux/css3/filters/crash-hw-sw-switch-expected.png:
    * platform/chromium-linux/css3/filters/custom/custom-filter-shader-cache-expected.png:
    * platform/chromium-linux/css3/filters/custom/effect-custom-expected.png:
    * platform/chromium-linux/css3/filters/custom/filter-repaint-custom-clipped-expected.png:
    * platform/chromium-linux/css3/filters/custom/filter-repaint-custom-expected.png:
    * platform/chromium-linux/css3/filters/custom/filter-repaint-custom-rotated-expected.png:
    * platform/chromium-linux/css3/filters/effect-brightness-clamping-expected.png:
    * platform/chromium-linux/css3/filters/effect-brightness-expected.png:
    * platform/chromium-linux/svg/filters/color-interpolation-filters-expected.png: Added.
    * platform/chromium-linux/svg/filters/color-interpolation-filters-expected.txt: Added.
    * platform/chromium-win/css3/filters/add-filter-rendering-expected.png:
    * platform/chromium-win/css3/filters/crash-filter-change-expected.png:
    * platform/chromium-win/css3/filters/effect-blur-expected.png:
    * platform/chromium-win/css3/filters/effect-combined-expected.png:
    * platform/chromium-win/css3/filters/effect-contrast-expected.png:
    * platform/chromium-win/css3/filters/effect-drop-shadow-expected.png:
    * platform/chromium-win/css3/filters/effect-grayscale-expected.png:
    * platform/chromium-win/css3/filters/effect-hue-rotate-expected.png:
    * platform/chromium-win/css3/filters/effect-invert-expected.png:
    * platform/chromium-win/css3/filters/effect-opacity-expected.png:
    * platform/chromium-win/css3/filters/effect-reference-expected.png:
    * platform/chromium-win/css3/filters/effect-reference-external-expected.png:
    * platform/chromium-win/css3/filters/effect-reference-hw-expected.png:
    * platform/chromium-win/css3/filters/effect-reference-ordering-expected.png:
    * platform/chromium-win/css3/filters/effect-saturate-expected.png:
    * platform/chromium-win/css3/filters/effect-sepia-expected.png:
    * platform/chromium-win/css3/filters/filtered-inline-expected.png:
    * platform/chromium-win/css3/filters/multiple-filters-invalidation-expected.png:
    * platform/chromium-win/css3/filters/nested-filters-expected.png:
    * platform/chromium-win/css3/filters/regions-expanding-expected.png:
    * platform/chromium-win/css3/filters/simple-filter-rendering-expected.png:
    * platform/chromium/TestExpectations:
    * platform/chromium/css3/filters/blur-filter-page-scroll-expected.png:
    * platform/chromium/css3/filters/blur-filter-page-scroll-parents-expected.png:
    * platform/mac/TestExpectations:
    * platform/qt/TestExpectations:
    * svg/filters/color-interpolation-filters.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    fd7cfc7f