Bug 75129 - CIFilter version of Sepia Tone filter doesn't match software
Summary: CIFilter version of Sepia Tone filter doesn't match software
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.7
: P2 Normal
Assignee: Chris Marrin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-12-22 14:46 PST by Chris Marrin
Modified: 2012-01-10 17:07 PST (History)
4 users (show)

See Also:


Attachments
Patch (37.96 KB, patch)
2012-01-10 16:06 PST, Chris Marrin
simon.fraser: review+
simon.fraser: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2011-12-22 14:46:04 PST
The formula used to compute sepia in the CIFilter is very different from that in the CSS filters spec, so it needs to change to use a Color Matrix filter to get the formula right.
Comment 1 Radar WebKit Bug Importer 2011-12-22 14:47:09 PST
<rdar://problem/10621337>
Comment 2 Chris Marrin 2012-01-10 16:06:47 PST
Created attachment 121930 [details]
Patch
Comment 3 Simon Fraser (smfr) 2012-01-10 16:10:00 PST
Comment on attachment 121930 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=121930&action=review

> Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm:706
> +static double interp(double from, double to, double t)
> +{
> +    return from * (1 - t) + to * t;
> +}

This is what WebCore::blend() is for.

> Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm:761
> +            if (t < 0)
> +                t = 0;
> +            else if (t > 1)
> +                t = 1;

Use std::min/max?

> Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm:765
> +            [caFilter setValue:[CIVector vectorWithX:interp(1, 0.393, t) Y:interp(0, 0.769, t) Z:interp(0, 0.189, t) W:0] forKey:@"inputRVector"];
> +            [caFilter setValue:[CIVector vectorWithX:interp(0, 0.349, t) Y:interp(1, 0.686, t) Z:interp(0, 0.168, t) W:0] forKey:@"inputGVector"];
> +            [caFilter setValue:[CIVector vectorWithX:interp(0, 0.272, t) Y:interp(0, 0.534, t) Z:interp(1, 0.131, t) W:0] forKey:@"inputBVector"];

Is there a canonical reference for those numeric values?

> LayoutTests/ChangeLog:8
> +        Updated hw sepia tone results to match changes. Updated sw results because

hw -> hardware, or more specifically "Core Image filter on Core Animation layer"
Comment 4 Chris Marrin 2012-01-10 17:07:28 PST
Committed r104652: <http://trac.webkit.org/changeset/104652>