Title: [104652] trunk
Revision
104652
Author
[email protected]
Date
2012-01-10 17:07:14 -0800 (Tue, 10 Jan 2012)

Log Message

CIFilter version of Sepia Tone filter doesn't match software
https://bugs.webkit.org/show_bug.cgi?id=75129

Reviewed by Simon Fraser.

Source/WebCore:

Changed sepia tone filter to use a CIColorMatrix filter with
values that match sw filter.

* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(interp):
(PlatformCALayer::setFilters):

LayoutTests:

Updated sepia tone results for core image filters on CA layers to match changes. Updated sw results because
they had the wrong color space

* css3/filters/effect-sepia-expected.png:
* css3/filters/effect-sepia-hw-expected.png:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104651 => 104652)


--- trunk/LayoutTests/ChangeLog	2012-01-11 00:42:11 UTC (rev 104651)
+++ trunk/LayoutTests/ChangeLog	2012-01-11 01:07:14 UTC (rev 104652)
@@ -1,3 +1,16 @@
+2012-01-10  Chris Marrin  <[email protected]>
+
+        CIFilter version of Sepia Tone filter doesn't match software
+        https://bugs.webkit.org/show_bug.cgi?id=75129
+
+        Reviewed by Simon Fraser.
+
+        Updated sepia tone results for core image filters on CA layers to match changes. Updated sw results because
+        they had the wrong color space
+
+        * css3/filters/effect-sepia-expected.png:
+        * css3/filters/effect-sepia-hw-expected.png:
+
 2012-01-10  Tony Chang  <[email protected]>
 
         Need to handle absolutely positioned elements inside flexboxes

Modified: trunk/LayoutTests/css3/filters/effect-sepia-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/css3/filters/effect-sepia-hw-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (104651 => 104652)


--- trunk/Source/WebCore/ChangeLog	2012-01-11 00:42:11 UTC (rev 104651)
+++ trunk/Source/WebCore/ChangeLog	2012-01-11 01:07:14 UTC (rev 104652)
@@ -1,3 +1,17 @@
+2012-01-10  Chris Marrin  <[email protected]>
+
+        CIFilter version of Sepia Tone filter doesn't match software
+        https://bugs.webkit.org/show_bug.cgi?id=75129
+
+        Reviewed by Simon Fraser.
+
+        Changed sepia tone filter to use a CIColorMatrix filter with
+        values that match sw filter.
+
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (interp):
+        (PlatformCALayer::setFilters):
+
 2012-01-10  Viatcheslav Ostapenko  <[email protected]>
 
         [Qt][WK2]REGRESSION(r102435): It made tst_QQuickWebView::show() crash

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (104651 => 104652)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2012-01-11 00:42:11 UTC (rev 104651)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2012-01-11 01:07:14 UTC (rev 104652)
@@ -29,6 +29,7 @@
 
 #import "PlatformCALayer.h"
 
+#import "AnimationUtilities.h"
 #import "BlockExceptions.h"
 #import "FloatConversion.h"
 #import "GraphicsContext.h"
@@ -44,6 +45,9 @@
 
 #define HAVE_MODERN_QUARTZCORE (!defined(BUILDING_ON_LEOPARD))
 
+using std::min;
+using std::max;
+
 using namespace WebCore;
 
 // This value must be the same as in PlatformCAAnimationMac.mm
@@ -746,9 +750,18 @@
         }
         case FilterOperation::SEPIA: {
             const BasicColorMatrixFilterOperation* op = static_cast<const BasicColorMatrixFilterOperation*>(filterOperation);
-            CIFilter* caFilter = [CIFilter filterWithName:@"CISepiaTone"];
+            CIFilter* caFilter = [CIFilter filterWithName:@"CIColorMatrix"];
             [caFilter setDefaults];
-            [caFilter setValue:[NSNumber numberWithFloat:op->amount()] forKey:@"inputIntensity"];
+            
+            double t = op->amount();
+            t = min(max(0.0, t), 1.0);
+
+            // FIXME: Should put these values into constants (https://bugs.webkit.org/show_bug.cgi?id=76008)
+            [caFilter setValue:[CIVector vectorWithX:WebCore::blend(1.0, 0.393, t) Y:WebCore::blend(0.0, 0.769, t) Z:WebCore::blend(0.0, 0.189, t) W:0] forKey:@"inputRVector"];
+            [caFilter setValue:[CIVector vectorWithX:WebCore::blend(0.0, 0.349, t) Y:WebCore::blend(1.0, 0.686, t) Z:WebCore::blend(0.0, 0.168, t) W:0] forKey:@"inputGVector"];
+            [caFilter setValue:[CIVector vectorWithX:WebCore::blend(0.0, 0.272, t) Y:WebCore::blend(0.0, 0.534, t) Z:WebCore::blend(1.0, 0.131, t) W:0] forKey:@"inputBVector"];
+            [caFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:1] forKey:@"inputAVector"];
+            [caFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:0] forKey:@"inputBiasVector"];
             [caFilter setName:@"sepiaFilter"];
             [array.get() addObject:caFilter];
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to