[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 17:55:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3995ce95688f25a121968116c9f41b467eb08a61
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 2 19:23:55 2010 +0000

    2010-12-02  W. James MacLean  <wjmaclean at chromium.org>
    
            Reviewed by James Robinson.
    
            Scaled Resized images are blurred when sent to Skia
            https://bugs.webkit.org/show_bug.cgi?id=42370
    
            * platform/chromium-linux/svg/custom/image-rescale-clip-expected.checksum: Added.
            * platform/chromium-linux/svg/custom/image-rescale-clip-expected.png: Added.
            * platform/chromium-linux/svg/custom/image-rescale-clip-expected.txt: Added.
            * platform/chromium-linux/svg/custom/image-rescale-expected.checksum: Added.
            * platform/chromium-linux/svg/custom/image-rescale-expected.png: Added.
            * platform/chromium-linux/svg/custom/image-rescale-expected.txt: Added.
            * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.checksum: Added.
            * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.png: Added.
            * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.txt: Added.
            * platform/chromium/test_expectations.txt:
            * platform/mac-leopard/svg/custom/image-rescale-expected.checksum: Added.
            * platform/mac-leopard/svg/custom/image-rescale-expected.png: Added.
            * platform/mac-leopard/svg/custom/image-rescale-expected.txt: Added.
            * platform/mac/svg/custom/image-rescale-clip-expected.checksum: Added.
            * platform/mac/svg/custom/image-rescale-clip-expected.png: Added.
            * platform/mac/svg/custom/image-rescale-clip-expected.txt: Added.
            * platform/mac/svg/custom/image-rescale-expected.checksum: Added.
            * platform/mac/svg/custom/image-rescale-expected.png: Added.
            * platform/mac/svg/custom/image-rescale-expected.txt: Added.
            * platform/mac/svg/custom/image-rescale-scroll-expected.checksum: Added.
            * platform/mac/svg/custom/image-rescale-scroll-expected.png: Added.
            * platform/mac/svg/custom/image-rescale-scroll-expected.txt: Added.
            * svg/custom/image-rescale-clip.html: Added.
            * svg/custom/image-rescale-scroll.html: Added.
            * svg/custom/image-rescale.svg: Added.
            * svg/custom/resources/image-rescale.jpg: Added.
    2010-12-02  W. James MacLean  <wjmaclean at chromium.org>
    
            Reviewed by James Robinson.
    
            Scaled Resized images are blurred when sent to Skia
            https://bugs.webkit.org/show_bug.cgi?id=42370
    
            This patch modifies ImageSkia.cpp to fix the calculation of resampled
            bitmap sizes so as to include the transform matrix of the canvas.
            Includes new tests to catch a scrolling regression and a clipping regression.
    
            Tests: svg/custom/image-rescale-clip.html
                   svg/custom/image-rescale-scroll.html
                   svg/custom/image-rescale.svg
    
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::computeResamplingMode):
            (WebCore::drawResampledBitmap):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73169 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ed44c75..fc69e8a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,37 @@
+2010-12-02  W. James MacLean  <wjmaclean at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Scaled Resized images are blurred when sent to Skia
+        https://bugs.webkit.org/show_bug.cgi?id=42370
+
+        * platform/chromium-linux/svg/custom/image-rescale-clip-expected.checksum: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-clip-expected.png: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-clip-expected.txt: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-expected.checksum: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-expected.png: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-expected.txt: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.checksum: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.png: Added.
+        * platform/chromium-linux/svg/custom/image-rescale-scroll-expected.txt: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/mac-leopard/svg/custom/image-rescale-expected.checksum: Added.
+        * platform/mac-leopard/svg/custom/image-rescale-expected.png: Added.
+        * platform/mac-leopard/svg/custom/image-rescale-expected.txt: Added.
+        * platform/mac/svg/custom/image-rescale-clip-expected.checksum: Added.
+        * platform/mac/svg/custom/image-rescale-clip-expected.png: Added.
+        * platform/mac/svg/custom/image-rescale-clip-expected.txt: Added.
+        * platform/mac/svg/custom/image-rescale-expected.checksum: Added.
+        * platform/mac/svg/custom/image-rescale-expected.png: Added.
+        * platform/mac/svg/custom/image-rescale-expected.txt: Added.
+        * platform/mac/svg/custom/image-rescale-scroll-expected.checksum: Added.
+        * platform/mac/svg/custom/image-rescale-scroll-expected.png: Added.
+        * platform/mac/svg/custom/image-rescale-scroll-expected.txt: Added.
+        * svg/custom/image-rescale-clip.html: Added.
+        * svg/custom/image-rescale-scroll.html: Added.
+        * svg/custom/image-rescale.svg: Added.
+        * svg/custom/resources/image-rescale.jpg: Added.
+
 2010-12-02  Erik Arvidsson  <arv at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.checksum b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.checksum
new file mode 100644
index 0000000..e23588e
--- /dev/null
+++ b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.checksum
@@ -0,0 +1 @@
+8d0488b6aea79342c72c68603363898b
\ No newline at end of file
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.png b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.png
new file mode 100644
index 0000000..972666a
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.txt b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.txt
new file mode 100644
index 0000000..f93577e
--- /dev/null
+++ b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-clip-expected.txt
@@ -0,0 +1,17 @@
+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 784x576
+      RenderBlock (anonymous) at (0,0) size 784x20
+        RenderBR {BR} at (0,0) size 0x19
+      RenderBlock {DIV} at (0,36) size 784x20
+        RenderBlock {P} at (0,0) size 784x20
+          RenderText {#text} at (0,0) size 335x19
+            text run at (0,0) width 335: "This test verifies correct paint of clipped, scaled images."
+layer at (8,8) size 160x105 backgroundClip at (8,8) size 150x15 clip at (8,8) size 150x15 outlineClip at (8,8) size 150x15
+  RenderBlock (positioned) {DIV} at (8,8) size 160x105
+    RenderText {#text} at (0,0) size 0x0
+    RenderText {#text} at (0,0) size 0x0
+layer at (13,13) size 160x105 backgroundClip at (8,8) size 150x15 clip at (8,8) size 150x15 outlineClip at (8,8) size 150x15
+  RenderImage {IMG} at (0,0) size 160x105
diff --git a/LayoutTests/platform/chromium-mac/svg/custom/image-rescale-expected.checksum b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-expected.checksum
similarity index 100%
copy from LayoutTests/platform/chromium-mac/svg/custom/image-rescale-expected.checksum
copy to LayoutTests/platform/chromium-linux/svg/custom/image-rescale-expected.checksum
diff --git a/LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-expected.txt
similarity index 100%
copy from LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt
copy to LayoutTests/platform/chromium-linux/svg/custom/image-rescale-expected.txt
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.checksum b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.checksum
new file mode 100644
index 0000000..fb0d05d
--- /dev/null
+++ b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.checksum
@@ -0,0 +1 @@
+2e7c0b5776e8cb5e7d5cc68dbf9b483c
\ No newline at end of file
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.png b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.png
new file mode 100644
index 0000000..f344e73
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.txt b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.txt
new file mode 100644
index 0000000..de0d8ce
--- /dev/null
+++ b/LayoutTests/platform/chromium-linux/svg/custom/image-rescale-scroll-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x685
+  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 784x576
+      RenderBlock {P} at (0,0) size 784x20
+        RenderText {#text} at (0,0) size 520x19
+          text run at (0,0) width 520: "This test verifies correct repaint of scrolled/re-painted-after-uncovering, scaled images."
+      RenderBlock {P} at (0,36) size 784x40
+        RenderText {#text} at (0,0) size 772x39
+          text run at (0,0) width 533: "If successful, the image below extends past the bottom of the window, with no white bar "
+          text run at (533,0) width 239: "occluding the part of the image adjacent"
+          text run at (0,20) width 175: "to the bottom of the window."
+layer at (50,580) size 160x105
+  RenderImage {IMG} at (50,580) size 160x105
+layer at (0,600) size 300x10
+  RenderBlock (positioned) {DIV} at (0,600) size 300x10 [bgcolor=#FFFFFF]
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index af7189b..ac3ecd2 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -928,6 +928,18 @@ BUGWK44514 LINUX WIN : svg/custom/missing-xlink.svg = TEXT
 // Also fail since WK roll 65859:65885
 BUGWK44514 MAC : fast/backgrounds/svg-as-background-6.html = IMAGE
 
+// May require re-baseline.
+BUGWK42370 WIN MAC : svg/custom/image-rescale.svg = FAIL
+BUGWK42370 WIN MAC : svg/custom/image-rescale-scroll.html = FAIL
+BUGWK42370 WIN MAC : svg/custom/image-rescale-clip.html = FAIL
+
+// Some re-baselining will be needed.
+BUGWK49456 MAC WIN : svg/custom/svg-parse-overflow-1.html = FAIL
+BUGWK49456 MAC WIN : svg/custom/svg-parse-overflow-2.html = FAIL
+BUGWK49456 MAC WIN : svg/custom/svg-parse-overflow-3.html = FAIL
+BUGWK49456 MAC WIN : svg/custom/svg-parse-overflow-4.html = FAIL
+BUGWK49456 MAC WIN : svg/custom/svg-parse-overflow-5.html = FAIL
+
 // -----------------------------------------------------------------
 // End SVG Regressions
 // -----------------------------------------------------------------
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.checksum b/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.checksum
new file mode 100644
index 0000000..ef327c4
--- /dev/null
+++ b/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.checksum
@@ -0,0 +1 @@
+917ccc88f3cfe6f2d9117e035758a8ce
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.png b/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.png
new file mode 100644
index 0000000..0f4f811
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.png differ
diff --git a/LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt b/LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.txt
similarity index 100%
copy from LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt
copy to LayoutTests/platform/mac-leopard/svg/custom/image-rescale-expected.txt
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.checksum b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.checksum
new file mode 100644
index 0000000..1c35097
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.checksum
@@ -0,0 +1 @@
+a65b6df20b67fb504b44246247bb2721
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.png b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.png
new file mode 100644
index 0000000..f60be88
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.txt b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.txt
new file mode 100644
index 0000000..3781710
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/image-rescale-clip-expected.txt
@@ -0,0 +1,17 @@
+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 784x576
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderBR {BR} at (0,0) size 0x18
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderBlock {P} at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 351x18
+            text run at (0,0) width 351: "This test verifies correct paint of clipped, scaled images."
+layer at (8,8) size 160x105 backgroundClip at (8,8) size 150x15 clip at (8,8) size 150x15 outlineClip at (8,8) size 150x15
+  RenderBlock (positioned) {DIV} at (8,8) size 160x105
+    RenderText {#text} at (0,0) size 0x0
+    RenderText {#text} at (0,0) size 0x0
+layer at (13,13) size 160x105 backgroundClip at (8,8) size 150x15 clip at (8,8) size 150x15 outlineClip at (8,8) size 150x15
+  RenderImage {IMG} at (0,0) size 160x105
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-expected.checksum b/LayoutTests/platform/mac/svg/custom/image-rescale-expected.checksum
new file mode 100644
index 0000000..1ad1cc2
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/image-rescale-expected.checksum
@@ -0,0 +1 @@
+29f1811b52fc6c7305477ddf83ebcc26
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-expected.png b/LayoutTests/platform/mac/svg/custom/image-rescale-expected.png
new file mode 100644
index 0000000..93f2b35
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/image-rescale-expected.png differ
diff --git a/LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt b/LayoutTests/platform/mac/svg/custom/image-rescale-expected.txt
similarity index 100%
copy from LayoutTests/platform/gtk/svg/custom/image-rescale-expected.txt
copy to LayoutTests/platform/mac/svg/custom/image-rescale-expected.txt
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.checksum b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.checksum
new file mode 100644
index 0000000..d0184e5
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.checksum
@@ -0,0 +1 @@
+7757b91bc39a46e961722697f104353a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.png b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.png
new file mode 100644
index 0000000..7475725
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.txt b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.txt
new file mode 100644
index 0000000..d22d1c7
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/image-rescale-scroll-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x685
+  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 784x576
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 542x18
+          text run at (0,0) width 542: "This test verifies correct repaint of scrolled/re-painted-after-uncovering, scaled images."
+      RenderBlock {P} at (0,34) size 784x36
+        RenderText {#text} at (0,0) size 756x36
+          text run at (0,0) width 561: "If successful, the image below extends past the bottom of the window, with no white bar "
+          text run at (561,0) width 195: "occluding the part of the image"
+          text run at (0,18) width 239: "adjacent to the bottom of the window."
+layer at (50,580) size 160x105
+  RenderImage {IMG} at (50,580) size 160x105
+layer at (0,600) size 300x10
+  RenderBlock (positioned) {DIV} at (0,600) size 300x10 [bgcolor=#FFFFFF]
diff --git a/LayoutTests/svg/custom/image-rescale-clip.html b/LayoutTests/svg/custom/image-rescale-clip.html
new file mode 100644
index 0000000..4300157
--- /dev/null
+++ b/LayoutTests/svg/custom/image-rescale-clip.html
@@ -0,0 +1,18 @@
+<html>
+<!--
+This test checks for the regression bug that causes white, horizontal blank bars
+-->
+<body style="overflow:hidden;">
+<!-- It is important for the image to be loaded with only a small amount showing,
+     as ImageSkia will only do a partial load in this case, which is required to
+     trigger the regression. -->
+<div style="position: absolute; clip:rect(0px,150px,15px,0px);">
+  <img id = "pic" src="resources/image-rescale.jpg" width="160" height="105" style="position: relative; top: 5px; left: 5px;">
+  <!-- Rescaled to 1/2 normal size, required to trigger the regression. -->
+</div><br />
+<div>
+<p>This test verifies correct paint of clipped, scaled images.</p>
+</div>
+</body>
+</html>
+
diff --git a/LayoutTests/svg/custom/image-rescale-scroll.html b/LayoutTests/svg/custom/image-rescale-scroll.html
new file mode 100644
index 0000000..b4ccd0a
--- /dev/null
+++ b/LayoutTests/svg/custom/image-rescale-scroll.html
@@ -0,0 +1,43 @@
+<html>
+<!--
+This test checks for the regression bug that causes white, horizontal blank bars
+to occur when scrolling scaled images in Chromium. Since test_shell implements scrolling
+differently than Chrome, we simulate scrolling by occluding part of the image, and
+verifying it repaints correctly when the occlusion is removed. The image must straddle
+the bottom edge of the window with no more than about 20% visible in order to force
+ImageSkia to do a partial load, as this is a precondition of the regression.
+-->
+<script type='text/javascript'>
+
+  function doScroll()
+  {
+    // Remove occlusion after initial page draw.
+    var occluder = document.getElementById('occluder');
+    occluder.style.top = 600;
+
+    if (window.layoutTestController)
+      layoutTestController.notifyDone();
+  }
+
+  if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+</script>
+<body onLoad="doScroll();" style="overflow:hidden;">
+<p>This test verifies correct repaint of scrolled/re-painted-after-uncovering, scaled images.</p>
+<p>If successful, the image below extends past the bottom of the window, with no white bar
+   occluding the part of the image adjacent to the bottom of the window.</p>
+<!-- It is important for the image to be loaded with only a small amount showing,
+     as ImageSkia will only do a partial load in this case, which is required to
+     trigger the regression. -->
+<img id = "pic" src="resources/image-rescale.jpg" width="160" height="105"
+    style="position: absolute; left: 50px; top:580px"
+    > <!-- Rescaled to 1/2 normal size, required to trigger the regression. -->
+
+<!-- The div below occludes part of the image. It is removed shortly after the
+     document has loaded, but if the regression is present the image will not
+     repaint correctly. -->
+<div id="occluder" style="position:absolute; left:0px; top:590px; width:300px; height:10px; background:white;"></div>
+</body>
+</html>
+
diff --git a/LayoutTests/svg/custom/image-rescale.svg b/LayoutTests/svg/custom/image-rescale.svg
new file mode 100644
index 0000000..e274b70
--- /dev/null
+++ b/LayoutTests/svg/custom/image-rescale.svg
@@ -0,0 +1,8 @@
+<svg version="1.1"
+     xmlns="http://www.w3.org/2000/svg"
+     xmlns:xlink="http://www.w3.org/1999/xlink"
+     id="drawingArea-layers" width="700" height="400" >
+     <image  x="0" y="0" width="320" height="210" xlink:href="resources/image-rescale.jpg" />
+     <image  x="350" y="0" width="32.0" height="21.0" transform="translate(350 0) scale(10) translate(-350 0)"
+             xlink:href="resources/image-rescale.jpg" />
+</svg>
diff --git a/LayoutTests/svg/custom/resources/image-rescale.jpg b/LayoutTests/svg/custom/resources/image-rescale.jpg
new file mode 100644
index 0000000..a827f37
Binary files /dev/null and b/LayoutTests/svg/custom/resources/image-rescale.jpg differ
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 26e3072..6b97d93 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-12-02  W. James MacLean  <wjmaclean at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Scaled Resized images are blurred when sent to Skia
+        https://bugs.webkit.org/show_bug.cgi?id=42370
+
+        This patch modifies ImageSkia.cpp to fix the calculation of resampled
+        bitmap sizes so as to include the transform matrix of the canvas.
+        Includes new tests to catch a scrolling regression and a clipping regression.
+
+        Tests: svg/custom/image-rescale-clip.html
+               svg/custom/image-rescale-scroll.html
+               svg/custom/image-rescale.svg
+
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::computeResamplingMode):
+        (WebCore::drawResampledBitmap):
+
 2010-12-02  Erik Arvidsson  <arv at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index ae2653a..c7fa6f4 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -143,7 +143,9 @@ static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext
 
     // Everything else gets resampled.
     // If the platform context permits high quality interpolation, use it.
-    if (platformContext->interpolationQuality() == InterpolationHigh)
+    // High quality interpolation only enabled for scaling and translation.
+    if (platformContext->interpolationQuality() == InterpolationHigh
+        && !(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
         return RESAMPLE_AWESOME;
     
     return RESAMPLE_LINEAR;
@@ -178,17 +180,32 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
     SkIRect resizedImageRect =  // Represents the size of the resized image.
         { 0, 0, destRectRounded.width(), destRectRounded.height() };
 
-    if (srcIsFull && bitmap.hasResizedBitmap(destRectRounded.width(), destRectRounded.height())) {
+    // Apply forward transform to destRect to estimate required size of
+    // re-sampled bitmap, and use only in calls required to resize, or that
+    // check for the required size.
+    SkRect destRectTransformed;
+    canvas.getTotalMatrix().mapRect(&destRectTransformed, destRect);
+    SkIRect destRectTransformedRounded;
+    destRectTransformed.round(&destRectTransformedRounded);
+
+    if (srcIsFull && bitmap.hasResizedBitmap(destRectTransformedRounded.width(), destRectTransformedRounded.height())) {
         // Yay, this bitmap frame already has a resized version.
-        SkBitmap resampled = bitmap.resizedBitmap(destRectRounded.width(), destRectRounded.height());
+        SkBitmap resampled = bitmap.resizedBitmap(destRectTransformedRounded.width(), destRectTransformedRounded.height());
         canvas.drawBitmapRect(resampled, 0, destRect, &paint);
         return;
     }
 
     // Compute the visible portion of our rect.
+    // We also need to compute the transformed portion of the
+    // visible portion for use below.
     SkRect destBitmapSubsetSk;
     ClipRectToCanvas(canvas, destRect, &destBitmapSubsetSk);
+    SkRect destBitmapSubsetTransformed;
+    canvas.getTotalMatrix().mapRect(&destBitmapSubsetTransformed, destBitmapSubsetSk);
     destBitmapSubsetSk.offset(-destRect.fLeft, -destRect.fTop);
+    SkIRect destBitmapSubsetTransformedRounded;
+    destBitmapSubsetTransformed.round(&destBitmapSubsetTransformedRounded);
+    destBitmapSubsetTransformedRounded.offset(-destRectTransformedRounded.fLeft, -destRectTransformedRounded.fTop);
 
     // The matrix inverting, etc. could have introduced rounding error which
     // causes the bounds to be outside of the resized bitmap. We round outward
@@ -207,27 +224,33 @@ static void drawResampledBitmap(SkCanvas& canvas, SkPaint& paint, const NativeIm
             destBitmapSubsetSkI.height())) {
         // We're supposed to resize the entire image and cache it, even though
         // we don't need all of it.
-        SkBitmap resampled = bitmap.resizedBitmap(destRectRounded.width(),
-                                                  destRectRounded.height());
+        SkBitmap resampled = bitmap.resizedBitmap(destRectTransformedRounded.width(),
+                                                  destRectTransformedRounded.height());
         canvas.drawBitmapRect(resampled, 0, destRect, &paint);
     } else {
         // We should only resize the exposed part of the bitmap to do the
         // minimal possible work.
 
         // Resample the needed part of the image.
-        SkBitmap resampled = skia::ImageOperations::Resize(subset,
-            skia::ImageOperations::RESIZE_LANCZOS3,
-            destRectRounded.width(), destRectRounded.height(),
-            destBitmapSubsetSkI);
-
-        // Compute where the new bitmap should be drawn. Since our new bitmap
-        // may be smaller than the original, we have to shift it over by the
-        // same amount that we cut off the top and left.
-        destBitmapSubsetSkI.offset(destRect.fLeft, destRect.fTop);
-        SkRect offsetDestRect;
-        offsetDestRect.set(destBitmapSubsetSkI);
-
-        canvas.drawBitmapRect(resampled, 0, offsetDestRect, &paint);
+        // Transforms above plus rounding may cause destBitmapSubsetTransformedRounded
+        // to go outside the image, so need to clip to avoid problems.
+        if (destBitmapSubsetTransformedRounded.intersect(0, 0,
+                destRectTransformedRounded.width(), destRectTransformedRounded.height())) {
+
+            SkBitmap resampled = skia::ImageOperations::Resize(subset,
+                skia::ImageOperations::RESIZE_LANCZOS3,
+                destRectTransformedRounded.width(), destRectTransformedRounded.height(),
+                destBitmapSubsetTransformedRounded);
+
+            // Compute where the new bitmap should be drawn. Since our new bitmap
+            // may be smaller than the original, we have to shift it over by the
+            // same amount that we cut off the top and left.
+            destBitmapSubsetSkI.offset(destRect.fLeft, destRect.fTop);
+            SkRect offsetDestRect;
+            offsetDestRect.set(destBitmapSubsetSkI);
+
+            canvas.drawBitmapRect(resampled, 0, offsetDestRect, &paint);
+        }
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list