Title: [101638] trunk
Revision
101638
Author
[email protected]
Date
2011-12-01 01:02:53 -0800 (Thu, 01 Dec 2011)

Log Message

SVG Gaussian blur in 1-dimension is incorrect
https://bugs.webkit.org/show_bug.cgi?id=73029

Patch by Florin Malita <[email protected]> on 2011-12-01
Reviewed by Simon Fraser.

Source/WebCore:

Ensure that the last blurBox result is stored when applying one-dimensional blurs.

* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplyGeneric):

LayoutTests:

* platform/chromium-win/svg/filters/feGaussianBlur-expected.png: Rebaseline.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101637 => 101638)


--- trunk/LayoutTests/ChangeLog	2011-12-01 08:47:49 UTC (rev 101637)
+++ trunk/LayoutTests/ChangeLog	2011-12-01 09:02:53 UTC (rev 101638)
@@ -1,3 +1,12 @@
+2011-12-01  Florin Malita  <[email protected]>
+
+        SVG Gaussian blur in 1-dimension is incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=73029
+
+        Reviewed by Simon Fraser.
+
+        * platform/chromium-win/svg/filters/feGaussianBlur-expected.png: Rebaseline.
+
 2011-12-01  Hayato Ito  <[email protected]>
 
         Unreviewed.  Chromium rebaselines.

Modified: trunk/LayoutTests/platform/chromium-win/svg/filters/feGaussianBlur-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (101637 => 101638)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 08:47:49 UTC (rev 101637)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 09:02:53 UTC (rev 101638)
@@ -1,3 +1,15 @@
+2011-12-01  Florin Malita  <[email protected]>
+
+        SVG Gaussian blur in 1-dimension is incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=73029
+
+        Reviewed by Simon Fraser.
+
+        Ensure that the last blurBox result is stored when applying one-dimensional blurs.
+
+        * platform/graphics/filters/FEGaussianBlur.cpp:
+        (WebCore::FEGaussianBlur::platformApplyGeneric):
+
 2011-12-01  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Elements Panel edit as html looks weird with an arrow inside edit box.

Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (101637 => 101638)


--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp	2011-12-01 08:47:49 UTC (rev 101637)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp	2011-12-01 09:02:53 UTC (rev 101638)
@@ -37,7 +37,7 @@
 #include <wtf/MathExtras.h>
 #include <wtf/ParallelJobs.h>
 
-using std::max;
+using namespace std;
 
 static inline float gaussianKernelFactor()
 {
@@ -88,7 +88,7 @@
         for (int channel = 3; channel >= 0; --channel) {
             int sum = 0;
             // Fill the kernel
-            int maxKernelSize = std::min(dxRight, effectWidth);
+            int maxKernelSize = min(dxRight, effectWidth);
             for (int i = 0; i < maxKernelSize; ++i)
                 sum += srcPixelArray->get(line + i * stride + channel);
 
@@ -114,25 +114,29 @@
     int dxRight = 0;
     int dyLeft = 0;
     int dyRight = 0;
+    ByteArray* src = ""
+    ByteArray* dst = tmpPixelArray;
+
     for (int i = 0; i < 3; ++i) {
         if (kernelSizeX) {
             kernelPosition(i, kernelSizeX, dxLeft, dxRight);
-            boxBlur(srcPixelArray, tmpPixelArray, kernelSizeX, dxLeft, dxRight, 4, stride, paintSize.width(), paintSize.height(), isAlphaImage());
-        } else {
-            ByteArray* auxPixelArray = tmpPixelArray;
-            tmpPixelArray = srcPixelArray;
-            srcPixelArray = auxPixelArray;
+            boxBlur(src, dst, kernelSizeX, dxLeft, dxRight, 4, stride, paintSize.width(), paintSize.height(), isAlphaImage());
+            swap(src, dst);
         }
 
         if (kernelSizeY) {
             kernelPosition(i, kernelSizeY, dyLeft, dyRight);
-            boxBlur(tmpPixelArray, srcPixelArray, kernelSizeY, dyLeft, dyRight, stride, 4, paintSize.height(), paintSize.width(), isAlphaImage());
-        } else {
-            ByteArray* auxPixelArray = tmpPixelArray;
-            tmpPixelArray = srcPixelArray;
-            srcPixelArray = auxPixelArray;
+            boxBlur(src, dst, kernelSizeY, dyLeft, dyRight, stride, 4, paintSize.height(), paintSize.width(), isAlphaImage());
+            swap(src, dst);
         }
     }
+
+    // The final result should be stored in srcPixelArray.
+    if (dst == srcPixelArray) {
+        ASSERT(src->length() == dst->length());
+        memcpy(dst->data(), src->data(), src->length());
+    }
+
 }
 
 #if ENABLE(PARALLEL_JOBS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to