[Texmap] Support filters in TextureMapperImageBuffer
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 15:29:40 +0000 (15:29 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 15:29:40 +0000 (15:29 +0000)
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

32 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/qt-5.0-wk2/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/qt/css3/filters/crash-hw-sw-switch-expected.png
LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-combined-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-combined-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

index 20e7106..194c564 100644 (file)
@@ -1,3 +1,36 @@
+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
index 3426811..2190e9e 100644 (file)
@@ -383,6 +383,19 @@ fast/loader/submit-form-while-parsing-2.html
 # 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
index a958dd4..d36dc0e 100644 (file)
@@ -266,18 +266,12 @@ css3/filters/filter-property-parsing-invalid.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
index d1759a0..3599f83 100644 (file)
Binary files a/LayoutTests/platform/qt/css3/filters/crash-hw-sw-switch-expected.png and b/LayoutTests/platform/qt/css3/filters/crash-hw-sw-switch-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.png
new file mode 100644 (file)
index 0000000..80e4078
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-blur-hw-expected.txt
new file mode 100644 (file)
index 0000000..d486039
--- /dev/null
@@ -0,0 +1,20 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-combined-expected.png b/LayoutTests/platform/qt/css3/filters/effect-combined-expected.png
new file mode 100644 (file)
index 0000000..0be7896
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-combined-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-combined-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-combined-expected.txt
new file mode 100644 (file)
index 0000000..2ef020b
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.png
new file mode 100644 (file)
index 0000000..0be7896
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-combined-hw-expected.txt
new file mode 100644 (file)
index 0000000..2ef020b
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.png
new file mode 100644 (file)
index 0000000..162ee22
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-drop-shadow-hw-expected.txt
new file mode 100644 (file)
index 0000000..b378509
--- /dev/null
@@ -0,0 +1,24 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.png
new file mode 100644 (file)
index 0000000..ee02c3b
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-grayscale-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.png
new file mode 100644 (file)
index 0000000..62f83f3
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-hue-rotate-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.png
new file mode 100644 (file)
index 0000000..9320bb8
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-invert-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.png
new file mode 100644 (file)
index 0000000..9087185
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-opacity-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.png
new file mode 100644 (file)
index 0000000..91f672b
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-saturate-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
diff --git a/LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.png b/LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.png
new file mode 100644 (file)
index 0000000..badc6e3
Binary files /dev/null and b/LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.png differ
diff --git a/LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.txt b/LayoutTests/platform/qt/css3/filters/effect-sepia-hw-expected.txt
new file mode 100644 (file)
index 0000000..64ed1c7
--- /dev/null
@@ -0,0 +1,28 @@
+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
index b86327d..2ad8051 100644 (file)
@@ -1,3 +1,39 @@
+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
index bd0da83..46169c6 100644 (file)
@@ -383,4 +383,12 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
     return adoptPtr(new GraphicsLayerTextureMapper(client));
 }
 
+#if ENABLE(CSS_FILTERS)
+bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
+{
+    notifyChange(TextureMapperLayer::FilterChange);
+    return GraphicsLayer::setFilters(filters);
+}
+#endif
+
 }
index 2a4dab1..07f3786 100644 (file)
@@ -90,6 +90,10 @@ public:
     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;
index ff51311..093435b 100644 (file)
@@ -27,6 +27,7 @@
     #endif
 #endif
 
+#include "FilterOperations.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "IntSize.h"
@@ -71,6 +72,10 @@ public:
     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;
index 783b03b..2458b20 100644 (file)
@@ -20,6 +20,8 @@
 #include "config.h"
 #include "TextureMapperImageBuffer.h"
 
+#include "FilterEffectRenderer.h"
+
 #if USE(TEXTURE_MAPPER)
 namespace WebCore {
 
@@ -101,5 +103,21 @@ void TextureMapperImageBuffer::drawTexture(const BitmapTexture& texture, const F
     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
index 8411206..daa4aea 100644 (file)
@@ -43,6 +43,10 @@ public:
     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;
index 368d3e1..27325b8 100644 (file)
@@ -210,6 +210,10 @@ IntRect TextureMapperLayer::intermediateSurfaceRect(const TransformationMatrix&
 
 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;
@@ -260,6 +264,28 @@ void TextureMapperLayer::paintSelfAndChildrenWithReplica(const TextureMapperPain
     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())
@@ -297,6 +323,10 @@ void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options
     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)
@@ -388,6 +418,10 @@ void TextureMapperLayer::syncCompositingStateSelf(GraphicsLayerTextureMapper* gr
     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());
index b0d9457..e10d5a7 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef TextureMapperLayer_h
 #define TextureMapperLayer_h
 
+#include "FilterOperations.h"
 #include "FloatRect.h"
 #include "GraphicsContext.h"
 #include "GraphicsLayer.h"
@@ -88,7 +89,8 @@ public:
         BackgroundColorChange =     (1L << 19),
 
         ReplicaLayerChange =        (1L << 20),
-        AnimationChange =           (1L << 21)
+        AnimationChange =           (1L << 21),
+        FilterChange =              (1L << 22)
     };
 
     enum SyncOptions {
@@ -182,6 +184,10 @@ private:
         int descendantsWithContent;
         TextureMapperLayer* maskLayer;
         TextureMapperLayer* replicaLayer;
+#if ENABLE(CSS_FILTERS)
+         FilterOperations filters;
+#endif
+
         bool preserves3D : 1;
         bool masksToBounds : 1;
         bool drawsContent : 1;