Changeset 107814 in webkit


Ignore:
Timestamp:
Feb 15, 2012 7:29:40 AM (12 years ago)
Author:
noam.rosenthal@nokia.com
Message:

[Texmap] Support filters in TextureMapperImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=76026

Source/WebCore:

Implement GraphicsLayer::setFilters for TextureMapper, and pass the filters all the way
to BitmapTextureImageBuffer. This does not introduce a new filters implementation, but
rather uses the non-AC implementation. A complete implementation will be needed in
TextureMapperGL, which can use some of the glue in this code.

Reviewed by Kenneth Rohde Christiansen.

Unskipped 10 tests in css3/filters.

  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

(WebCore):
(WebCore::GraphicsLayerTextureMapper::setFilters):

  • platform/graphics/texmap/GraphicsLayerTextureMapper.h:

(GraphicsLayerTextureMapper):

  • platform/graphics/texmap/TextureMapper.h:

(BitmapTexture):
(WebCore::BitmapTexture::applyFilters):

  • platform/graphics/texmap/TextureMapperImageBuffer.cpp:

(WebCore):
(WebCore::BitmapTextureImageBuffer::applyFilters):

  • platform/graphics/texmap/TextureMapperImageBuffer.h:

(BitmapTextureImageBuffer):

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::shouldPaintToIntermediateSurface):
(WebCore):
(WebCore::applyFilters):
(WebCore::TextureMapperLayer::paintRecursive):
(WebCore::TextureMapperLayer::syncCompositingStateSelf):

  • platform/graphics/texmap/TextureMapperLayer.h:

(State):

LayoutTests:

Unskipping hardware filter tests. They're still skipped in WebKit2.

Reviewed by Kenneth Rohde Christiansen.

  • platform/qt-5.0-wk2/Skipped:
  • platform/qt/Skipped:
  • platform/qt/css3/filters/crash-hw-sw-switch-expected.png:
  • platform/qt/css3/filters/effect-blur-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-blur-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-combined-expected.png: Added.
  • platform/qt/css3/filters/effect-combined-expected.txt: Added.
  • platform/qt/css3/filters/effect-combined-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-combined-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-drop-shadow-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-drop-shadow-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-grayscale-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-grayscale-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-hue-rotate-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-hue-rotate-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-invert-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-invert-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-opacity-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-opacity-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-saturate-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-saturate-hw-expected.txt: Added.
  • platform/qt/css3/filters/effect-sepia-hw-expected.png: Added.
  • platform/qt/css3/filters/effect-sepia-hw-expected.txt: Added.
Location:
trunk
Files:
20 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107807 r107814  
     12012-02-15  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Texmap] Support filters in TextureMapperImageBuffer
     4        https://bugs.webkit.org/show_bug.cgi?id=76026
     5
     6        Unskipping hardware filter tests. They're still skipped in WebKit2.
     7
     8        Reviewed by Kenneth Rohde Christiansen.
     9
     10        * platform/qt-5.0-wk2/Skipped:
     11        * platform/qt/Skipped:
     12        * platform/qt/css3/filters/crash-hw-sw-switch-expected.png:
     13        * platform/qt/css3/filters/effect-blur-hw-expected.png: Added.
     14        * platform/qt/css3/filters/effect-blur-hw-expected.txt: Added.
     15        * platform/qt/css3/filters/effect-combined-expected.png: Added.
     16        * platform/qt/css3/filters/effect-combined-expected.txt: Added.
     17        * platform/qt/css3/filters/effect-combined-hw-expected.png: Added.
     18        * platform/qt/css3/filters/effect-combined-hw-expected.txt: Added.
     19        * platform/qt/css3/filters/effect-drop-shadow-hw-expected.png: Added.
     20        * platform/qt/css3/filters/effect-drop-shadow-hw-expected.txt: Added.
     21        * platform/qt/css3/filters/effect-grayscale-hw-expected.png: Added.
     22        * platform/qt/css3/filters/effect-grayscale-hw-expected.txt: Added.
     23        * platform/qt/css3/filters/effect-hue-rotate-hw-expected.png: Added.
     24        * platform/qt/css3/filters/effect-hue-rotate-hw-expected.txt: Added.
     25        * platform/qt/css3/filters/effect-invert-hw-expected.png: Added.
     26        * platform/qt/css3/filters/effect-invert-hw-expected.txt: Added.
     27        * platform/qt/css3/filters/effect-opacity-hw-expected.png: Added.
     28        * platform/qt/css3/filters/effect-opacity-hw-expected.txt: Added.
     29        * platform/qt/css3/filters/effect-saturate-hw-expected.png: Added.
     30        * platform/qt/css3/filters/effect-saturate-hw-expected.txt: Added.
     31        * platform/qt/css3/filters/effect-sepia-hw-expected.png: Added.
     32        * platform/qt/css3/filters/effect-sepia-hw-expected.txt: Added.
     33
    1342012-02-15  Noel Gordon  <noel.gordon@gmail.com>
    235
  • trunk/LayoutTests/platform/qt-5.0-wk2/Skipped

    r107090 r107814  
    384384css3/filters/should-not-have-compositing-layer.html
    385385
     386# Hardware filters don't work with GL yet
     387# https://bugs.webkit.org/show_bug.cgi?id=75778
     388css3/filters/crash-hw-sw-switch.html
     389css3/filters/effect-blur-hw.html
     390css3/filters/effect-combined-hw.html
     391css3/filters/effect-drop-shadow-hw.html
     392css3/filters/effect-grayscale-hw.html
     393css3/filters/effect-hue-rotate-hw.html
     394css3/filters/effect-invert-hw.html
     395css3/filters/effect-opacity-hw.html
     396css3/filters/effect-saturate-hw.html
     397css3/filters/effect-sepia-hw.html
     398
    386399# Unskipped on Qt5, but still fail on qt-wk2 platform
    387400editing/input/emacs-ctrl-o.html
  • trunk/LayoutTests/platform/qt/Skipped

    r107772 r107814  
    267267css3/filters/filter-property.html
    268268css3/filters/filter-repaint.html
    269 css3/filters/crash-hw-sw-switch.html
    270 css3/filters/effect-blur-hw.html
    271 css3/filters/effect-combined.html
    272 css3/filters/effect-combined-hw.html
     269
     270# CSS shaders
    273271css3/filters/effect-custom.html
    274 css3/filters/effect-drop-shadow-hw.html
    275 css3/filters/effect-grayscale-hw.html
    276 css3/filters/effect-hue-rotate-hw.html
    277 css3/filters/effect-invert-hw.html
    278 css3/filters/effect-opacity-hw.html
    279 css3/filters/effect-saturate-hw.html
    280 css3/filters/effect-sepia-hw.html
     272css3/filters/custom-filter-shader-cache.html
     273css3/filters/effect-custom-parameters.html
     274css3/filters/effect-custom-combined-missing.html
    281275
    282276# Support multipart responses is not implemented.
  • trunk/Source/WebCore/ChangeLog

    r107813 r107814  
     12012-02-15  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Texmap] Support filters in TextureMapperImageBuffer
     4        https://bugs.webkit.org/show_bug.cgi?id=76026
     5
     6        Implement GraphicsLayer::setFilters for TextureMapper, and pass the filters all the way
     7        to BitmapTextureImageBuffer. This does not introduce a new filters implementation, but
     8        rather uses the non-AC implementation. A complete implementation will be needed in
     9        TextureMapperGL, which can use some of the glue in this code.
     10
     11        Reviewed by Kenneth Rohde Christiansen.
     12
     13        Unskipped 10 tests in css3/filters.
     14
     15        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     16        (WebCore):
     17        (WebCore::GraphicsLayerTextureMapper::setFilters):
     18        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     19        (GraphicsLayerTextureMapper):
     20        * platform/graphics/texmap/TextureMapper.h:
     21        (BitmapTexture):
     22        (WebCore::BitmapTexture::applyFilters):
     23        * platform/graphics/texmap/TextureMapperImageBuffer.cpp:
     24        (WebCore):
     25        (WebCore::BitmapTextureImageBuffer::applyFilters):
     26        * platform/graphics/texmap/TextureMapperImageBuffer.h:
     27        (BitmapTextureImageBuffer):
     28        * platform/graphics/texmap/TextureMapperLayer.cpp:
     29        (WebCore::TextureMapperLayer::shouldPaintToIntermediateSurface):
     30        (WebCore):
     31        (WebCore::applyFilters):
     32        (WebCore::TextureMapperLayer::paintRecursive):
     33        (WebCore::TextureMapperLayer::syncCompositingStateSelf):
     34        * platform/graphics/texmap/TextureMapperLayer.h:
     35        (State):
     36
    1372012-02-15  Simon Hausmann  <simon.hausmann@nokia.com>
    238
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r107787 r107814  
    384384}
    385385
    386 }
     386#if ENABLE(CSS_FILTERS)
     387bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
     388{
     389    notifyChange(TextureMapperLayer::FilterChange);
     390    return GraphicsLayer::setFilters(filters);
     391}
     392#endif
     393
     394}
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r107787 r107814  
    9191    IntRect needsDisplayRect() const { return enclosingIntRect(m_needsDisplayRect); }
    9292
     93#if ENABLE(CSS_FILTERS)
     94    virtual bool setFilters(const FilterOperations&);
     95#endif
     96
    9397private:
    9498    OwnPtr<TextureMapperLayer> m_layer;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h

    r107707 r107814  
    2828#endif
    2929
     30#include "FilterOperations.h"
    3031#include "GraphicsContext.h"
    3132#include "IntRect.h"
     
    7172    inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; }
    7273    inline bool isOpaque() const { return m_isOpaque; }
     74
     75#if ENABLE(CSS_FILTERS)
     76    virtual void applyFilters(const BitmapTexture& contentTexture, const FilterOperations&) { }
     77#endif
    7378
    7479protected:
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp

    r106659 r107814  
    2020#include "config.h"
    2121#include "TextureMapperImageBuffer.h"
     22
     23#include "FilterEffectRenderer.h"
    2224
    2325#if USE(TEXTURE_MAPPER)
     
    102104}
    103105
     106#if ENABLE(CSS_FILTERS)
     107void BitmapTextureImageBuffer::applyFilters(const BitmapTexture& contentTexture, const FilterOperations& filters)
     108{
     109    RefPtr<FilterEffectRenderer> renderer = FilterEffectRenderer::create(0);
     110    renderer->setSourceImageRect(FloatRect(FloatPoint::zero(), contentTexture.size()));
     111
     112    // The document parameter is only needed for CSS shaders.
     113    renderer->build(0 /*document */, filters);
     114    renderer->prepare();
     115    GraphicsContext* context = renderer->inputContext();
     116    context->drawImageBuffer(static_cast<const BitmapTextureImageBuffer&>(contentTexture).m_image.get(), ColorSpaceDeviceRGB, IntPoint::zero());
     117    renderer->apply();
     118    m_image->context()->drawImageBuffer(renderer->output(), ColorSpaceDeviceRGB, renderer->outputRect());
    104119}
    105120#endif
     121
     122}
     123#endif
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h

    r106659 r107814  
    4444    virtual void updateContents(Image*, const IntRect&, const IntRect&, PixelFormat);
    4545    void updateContents(const void* data, const IntRect& targetRect);
     46#if ENABLE(CSS_FILTERS)
     47    void applyFilters(const BitmapTexture&, const FilterOperations&);
     48#endif
     49
    4650private:
    4751    BitmapTextureImageBuffer() { }
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r107787 r107814  
    211211bool TextureMapperLayer::shouldPaintToIntermediateSurface() const
    212212{
     213#if ENABLE(CSS_FILTERS)
     214    if (m_state.filters.size())
     215        return true;
     216#endif
    213217    bool hasOpacity = m_opacity < 0.99;
    214218    bool hasChildren = !m_children.isEmpty();
     
    261265}
    262266
     267#if ENABLE(CSS_FILTERS)
     268static PassRefPtr<BitmapTexture> applyFilters(const FilterOperations& filters, TextureMapper* textureMapper, BitmapTexture* source, IntRect& targetRect)
     269{
     270    if (!filters.size())
     271        return source;
     272
     273    RefPtr<BitmapTexture> filterSurface(source);
     274    int leftOutset, topOutset, bottomOutset, rightOutset;
     275    if (filters.hasOutsets()) {
     276        filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
     277        IntRect unfilteredTargetRect(targetRect);
     278        targetRect.move(std::max(0, -leftOutset), std::max(0, -topOutset));
     279        targetRect.expand(leftOutset + rightOutset, topOutset + bottomOutset);
     280        targetRect.unite(unfilteredTargetRect);
     281        filterSurface = textureMapper->acquireTextureFromPool(targetRect.size());
     282    }
     283
     284    filterSurface->applyFilters(*source, filters);
     285    return filterSurface;
     286}
     287#endif
     288
    263289void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options)
    264290{
     
    297323    if (m_state.replicaLayer)
    298324        maskTexture = 0;
     325
     326#if ENABLE(CSS_FILTERS)
     327    surface = applyFilters(m_state.filters, options.textureMapper, surface.get(), surfaceRect);
     328#endif
    299329
    300330    options.textureMapper->bindSurface(options.surface.get());
     
    389419    m_state.childrenTransform = graphicsLayer->childrenTransform();
    390420    m_state.opacity = graphicsLayer->opacity();
     421#if ENABLE(CSS_FILTERS)
     422    m_state.filters = graphicsLayer->filters();
     423#endif
     424
    391425    m_state.needsDisplay = m_state.needsDisplay || graphicsLayer->needsDisplay();
    392426    if (!m_state.needsDisplay)
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r107787 r107814  
    2121#define TextureMapperLayer_h
    2222
     23#include "FilterOperations.h"
    2324#include "FloatRect.h"
    2425#include "GraphicsContext.h"
     
    8990
    9091        ReplicaLayerChange =        (1L << 20),
    91         AnimationChange =           (1L << 21)
     92        AnimationChange =           (1L << 21),
     93        FilterChange =              (1L << 22)
    9294    };
    9395
     
    183185        TextureMapperLayer* maskLayer;
    184186        TextureMapperLayer* replicaLayer;
     187#if ENABLE(CSS_FILTERS)
     188         FilterOperations filters;
     189#endif
     190
    185191        bool preserves3D : 1;
    186192        bool masksToBounds : 1;
Note: See TracChangeset for help on using the changeset viewer.