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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107814
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-15 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Texmap] Support filters in TextureMapperImageBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=76026
+
+ 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.
+
2012-02-15 Noel Gordon <noel.gordon@gmail.com>
[chromium] Rebaseline JPEG image results after r107389
# https://bugs.webkit.org/show_bug.cgi?id=76061
css3/filters/should-not-have-compositing-layer.html
+# Hardware filters don't work with GL yet
+# https://bugs.webkit.org/show_bug.cgi?id=75778
+css3/filters/crash-hw-sw-switch.html
+css3/filters/effect-blur-hw.html
+css3/filters/effect-combined-hw.html
+css3/filters/effect-drop-shadow-hw.html
+css3/filters/effect-grayscale-hw.html
+css3/filters/effect-hue-rotate-hw.html
+css3/filters/effect-invert-hw.html
+css3/filters/effect-opacity-hw.html
+css3/filters/effect-saturate-hw.html
+css3/filters/effect-sepia-hw.html
+
# Unskipped on Qt5, but still fail on qt-wk2 platform
editing/input/emacs-ctrl-o.html
fast/block/float/float-in-float-hit-testing.html
css3/filters/filter-property-parsing.html
css3/filters/filter-property.html
css3/filters/filter-repaint.html
-css3/filters/crash-hw-sw-switch.html
-css3/filters/effect-blur-hw.html
-css3/filters/effect-combined.html
-css3/filters/effect-combined-hw.html
+
+# CSS shaders
css3/filters/effect-custom.html
-css3/filters/effect-drop-shadow-hw.html
-css3/filters/effect-grayscale-hw.html
-css3/filters/effect-hue-rotate-hw.html
-css3/filters/effect-invert-hw.html
-css3/filters/effect-opacity-hw.html
-css3/filters/effect-saturate-hw.html
-css3/filters/effect-sepia-hw.html
+css3/filters/custom-filter-shader-cache.html
+css3/filters/effect-custom-parameters.html
+css3/filters/effect-custom-combined-missing.html
# Support multipart responses is not implemented.
# https://bugs.webkit.org/show_bug.cgi?id=47060
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (180,98) size 4x16
+ text run at (180,98) width 4: " "
+ RenderText {#text} at (364,98) size 4x16
+ text run at (364,98) width 4: " "
+ RenderText {#text} at (548,98) size 4x16
+ text run at (548,98) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (18,18) size 160x90
+ RenderImage {IMG} at (10,10) size 160x90
+layer at (202,18) size 160x90
+ RenderImage {IMG} at (194,10) size 160x90
+layer at (386,18) size 160x90
+ RenderImage {IMG} at (378,10) size 160x90
+layer at (570,18) size 160x90
+ RenderImage {IMG} at (562,10) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (180,98) size 4x16
+ text run at (180,98) width 4: " "
+ RenderText {#text} at (364,98) size 4x16
+ text run at (364,98) width 4: " "
+ RenderText {#text} at (548,98) size 4x16
+ text run at (548,98) width 4: " "
+ RenderText {#text} at (732,98) size 4x16
+ text run at (732,98) width 4: " "
+ RenderText {#text} at (180,212) size 4x16
+ text run at (180,212) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (18,18) size 160x90
+ RenderImage {IMG} at (10,10) size 160x90
+layer at (202,18) size 160x90
+ RenderImage {IMG} at (194,10) size 160x90
+layer at (386,18) size 160x90
+ RenderImage {IMG} at (378,10) size 160x90
+layer at (570,18) size 160x90
+ RenderImage {IMG} at (562,10) size 160x90
+layer at (18,132) size 160x90
+ RenderImage {IMG} at (10,124) size 160x90
+layer at (202,132) size 160x90
+ RenderImage {IMG} at (194,124) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (180,98) size 4x16
+ text run at (180,98) width 4: " "
+ RenderText {#text} at (364,98) size 4x16
+ text run at (364,98) width 4: " "
+ RenderText {#text} at (548,98) size 4x16
+ text run at (548,98) width 4: " "
+ RenderText {#text} at (732,98) size 4x16
+ text run at (732,98) width 4: " "
+ RenderText {#text} at (180,212) size 4x16
+ text run at (180,212) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (18,18) size 160x90
+ RenderImage {IMG} at (10,10) size 160x90
+layer at (202,18) size 160x90
+ RenderImage {IMG} at (194,10) size 160x90
+layer at (386,18) size 160x90
+ RenderImage {IMG} at (378,10) size 160x90
+layer at (570,18) size 160x90
+ RenderImage {IMG} at (562,10) size 160x90
+layer at (18,132) size 160x90
+ RenderImage {IMG} at (10,124) size 160x90
+layer at (202,132) size 160x90
+ RenderImage {IMG} at (194,124) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (190,108) size 4x16
+ text run at (190,108) width 4: " "
+ RenderText {#text} at (384,108) size 4x16
+ text run at (384,108) width 4: " "
+ RenderText {#text} at (578,108) size 4x16
+ text run at (578,108) width 4: " "
+ RenderText {#text} at (772,108) size 4x16
+ text run at (772,108) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (23,23) size 160x90
+ RenderImage {IMG} at (15,15) size 160x90
+layer at (217,23) size 160x90
+ RenderImage {IMG} at (209,15) size 160x90
+layer at (411,23) size 160x90
+ RenderImage {IMG} at (403,15) size 160x90
+layer at (605,23) size 160x90
+ RenderImage {IMG} at (597,15) size 160x90
+layer at (23,147) size 160x90
+ RenderImage {IMG} at (15,139) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderText {#text} at (160,78) size 4x16
+ text run at (160,78) width 4: " "
+ RenderText {#text} at (324,78) size 4x16
+ text run at (324,78) width 4: " "
+ RenderText {#text} at (488,78) size 4x16
+ text run at (488,78) width 4: " "
+ RenderText {#text} at (652,78) size 4x16
+ text run at (652,78) width 4: " "
+ RenderText {#text} at (160,172) size 4x16
+ text run at (160,172) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 160x90
+ RenderImage {IMG} at (0,0) size 160x90
+layer at (172,8) size 160x90
+ RenderImage {IMG} at (164,0) size 160x90
+layer at (336,8) size 160x90
+ RenderImage {IMG} at (328,0) size 160x90
+layer at (500,8) size 160x90
+ RenderImage {IMG} at (492,0) size 160x90
+layer at (8,102) size 160x90
+ RenderImage {IMG} at (0,94) size 160x90
+layer at (172,102) size 160x90
+ RenderImage {IMG} at (164,94) size 160x90
+2012-02-15 No'am Rosenthal <noam.rosenthal@nokia.com>
+
+ [Texmap] Support filters in TextureMapperImageBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=76026
+
+ 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):
+
2012-02-15 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] Clean up fallback rendering of GraphicsContext3D to Canvas
return adoptPtr(new GraphicsLayerTextureMapper(client));
}
+#if ENABLE(CSS_FILTERS)
+bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
+{
+ notifyChange(TextureMapperLayer::FilterChange);
+ return GraphicsLayer::setFilters(filters);
+}
+#endif
+
}
bool needsDisplay() const { return m_needsDisplay; }
IntRect needsDisplayRect() const { return enclosingIntRect(m_needsDisplayRect); }
+#if ENABLE(CSS_FILTERS)
+ virtual bool setFilters(const FilterOperations&);
+#endif
+
private:
OwnPtr<TextureMapperLayer> m_layer;
RefPtr<TextureMapperBackingStore> m_compositedImage;
#endif
#endif
+#include "FilterOperations.h"
#include "GraphicsContext.h"
#include "IntRect.h"
#include "IntSize.h"
inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; }
inline bool isOpaque() const { return m_isOpaque; }
+#if ENABLE(CSS_FILTERS)
+ virtual void applyFilters(const BitmapTexture& contentTexture, const FilterOperations&) { }
+#endif
+
protected:
IntSize m_contentSize;
bool m_isOpaque;
#include "config.h"
#include "TextureMapperImageBuffer.h"
+#include "FilterEffectRenderer.h"
+
#if USE(TEXTURE_MAPPER)
namespace WebCore {
context->restore();
}
+#if ENABLE(CSS_FILTERS)
+void BitmapTextureImageBuffer::applyFilters(const BitmapTexture& contentTexture, const FilterOperations& filters)
+{
+ RefPtr<FilterEffectRenderer> renderer = FilterEffectRenderer::create(0);
+ renderer->setSourceImageRect(FloatRect(FloatPoint::zero(), contentTexture.size()));
+
+ // The document parameter is only needed for CSS shaders.
+ renderer->build(0 /*document */, filters);
+ renderer->prepare();
+ GraphicsContext* context = renderer->inputContext();
+ context->drawImageBuffer(static_cast<const BitmapTextureImageBuffer&>(contentTexture).m_image.get(), ColorSpaceDeviceRGB, IntPoint::zero());
+ renderer->apply();
+ m_image->context()->drawImageBuffer(renderer->output(), ColorSpaceDeviceRGB, renderer->outputRect());
+}
+#endif
+
}
#endif
inline GraphicsContext* graphicsContext() { return m_image ? m_image->context() : 0; }
virtual void updateContents(Image*, const IntRect&, const IntRect&, PixelFormat);
void updateContents(const void* data, const IntRect& targetRect);
+#if ENABLE(CSS_FILTERS)
+ void applyFilters(const BitmapTexture&, const FilterOperations&);
+#endif
+
private:
BitmapTextureImageBuffer() { }
OwnPtr<ImageBuffer> m_image;
bool TextureMapperLayer::shouldPaintToIntermediateSurface() const
{
+#if ENABLE(CSS_FILTERS)
+ if (m_state.filters.size())
+ return true;
+#endif
bool hasOpacity = m_opacity < 0.99;
bool hasChildren = !m_children.isEmpty();
bool hasReplica = !!m_state.replicaLayer;
paintSelfAndChildren(options);
}
+#if ENABLE(CSS_FILTERS)
+static PassRefPtr<BitmapTexture> applyFilters(const FilterOperations& filters, TextureMapper* textureMapper, BitmapTexture* source, IntRect& targetRect)
+{
+ if (!filters.size())
+ return source;
+
+ RefPtr<BitmapTexture> filterSurface(source);
+ int leftOutset, topOutset, bottomOutset, rightOutset;
+ if (filters.hasOutsets()) {
+ filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
+ IntRect unfilteredTargetRect(targetRect);
+ targetRect.move(std::max(0, -leftOutset), std::max(0, -topOutset));
+ targetRect.expand(leftOutset + rightOutset, topOutset + bottomOutset);
+ targetRect.unite(unfilteredTargetRect);
+ filterSurface = textureMapper->acquireTextureFromPool(targetRect.size());
+ }
+
+ filterSurface->applyFilters(*source, filters);
+ return filterSurface;
+}
+#endif
+
void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options)
{
if (!isVisible())
if (m_state.replicaLayer)
maskTexture = 0;
+#if ENABLE(CSS_FILTERS)
+ surface = applyFilters(m_state.filters, options.textureMapper, surface.get(), surfaceRect);
+#endif
+
options.textureMapper->bindSurface(options.surface.get());
TransformationMatrix targetTransform =
TransformationMatrix(options.transform)
m_state.backfaceVisibility = graphicsLayer->backfaceVisibility();
m_state.childrenTransform = graphicsLayer->childrenTransform();
m_state.opacity = graphicsLayer->opacity();
+#if ENABLE(CSS_FILTERS)
+ m_state.filters = graphicsLayer->filters();
+#endif
+
m_state.needsDisplay = m_state.needsDisplay || graphicsLayer->needsDisplay();
if (!m_state.needsDisplay)
m_state.needsDisplayRect.unite(graphicsLayer->needsDisplayRect());
#ifndef TextureMapperLayer_h
#define TextureMapperLayer_h
+#include "FilterOperations.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
BackgroundColorChange = (1L << 19),
ReplicaLayerChange = (1L << 20),
- AnimationChange = (1L << 21)
+ AnimationChange = (1L << 21),
+ FilterChange = (1L << 22)
};
enum SyncOptions {
int descendantsWithContent;
TextureMapperLayer* maskLayer;
TextureMapperLayer* replicaLayer;
+#if ENABLE(CSS_FILTERS)
+ FilterOperations filters;
+#endif
+
bool preserves3D : 1;
bool masksToBounds : 1;
bool drawsContent : 1;