Bug 130582 - [CSS Blending] Wrong color result for basic blend modes
Summary: [CSS Blending] Wrong color result for basic blend modes
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 95614 131377
  Show dependency treegraph
 
Reported: 2014-03-21 05:27 PDT by Ion Rosca
Modified: 2014-11-12 13:06 PST (History)
5 users (show)

See Also:


Attachments
Sample for 'difference' mode results (2.29 KB, text/html)
2014-03-21 05:27 PDT, Ion Rosca
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ion Rosca 2014-03-21 05:27:49 PDT
Created attachment 227417 [details]
Sample for 'difference' mode results 

According to the spec[1], the 'difference' blend mode should be computed using this formula: B(Cb, Cs) = | Cb - Cs |.
For example: Fuchsia difference Aqua = Yellow

The result in webkit is different than Yellow. On retina display it's a pale yellow rgb(204, 214, 0), but on non-retina displays, the result is a pale green rgb(0, 190, 0).

The behaviour is the same for both accelerated and non-accelerated blending. I did not test for other blend modes than difference (TBD).

[1] http://dev.w3.org/fxtf/compositing-1/#blendingdifference
Comment 1 Mihai Tica 2014-03-21 05:35:03 PDT
(In reply to comment #0)
> Created an attachment (id=227417) [details]
> Sample for 'difference' mode results 
> 
> According to the spec[1], the 'difference' blend mode should be computed using this formula: B(Cb, Cs) = | Cb - Cs |.
> For example: Fuchsia difference Aqua = Yellow
> 
> The result in webkit is different than Yellow. On retina display it's a pale yellow rgb(204, 214, 0), but on non-retina displays, the result is a pale green rgb(0, 190, 0).
> 
> The behaviour is the same for both accelerated and non-accelerated blending. I did not test for other blend modes than difference (TBD).
> 
> [1] http://dev.w3.org/fxtf/compositing-1/#blendingdifference

There are also problems with other blend modes. The biggest differences are with soft-light.
In fact, when validating canvas blend modes, the tests submitted https://bugs.webkit.org/show_bug.cgi?id=119082 entirely skip soft-light since the differences between the formula and the result are consistent.

Imho, this is rather a CG/CA bug.
Comment 2 Radar WebKit Bug Importer 2014-04-15 15:23:54 PDT
<rdar://problem/16626421>
Comment 3 Alexey Proskuryakov 2014-11-12 13:06:06 PST
This doesn't appear to be failing on bots any more, will remove the expectation.