Bug 157665 - cross-fade() rendering doesn't match expectation
Summary: cross-fade() rendering doesn't match expectation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-12 22:15 PDT by Simon Fraser (smfr)
Modified: 2016-11-04 16:20 PDT (History)
5 users (show)

See Also:


Attachments
Screenshot (30.67 KB, image/png)
2016-05-12 22:16 PDT, Simon Fraser (smfr)
no flags Details
Patch (7.57 KB, patch)
2016-05-13 14:42 PDT, Simon Fraser (smfr)
dino: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (913.74 KB, application/zip)
2016-05-13 15:00 PDT, Build Bot
no flags Details
Patch (7.91 KB, patch)
2016-05-13 15:01 PDT, Simon Fraser (smfr)
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-yosemite (1.43 MB, application/zip)
2016-05-13 15:30 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (791.37 KB, application/zip)
2016-05-13 15:30 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (649.70 KB, application/zip)
2016-05-13 15:35 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2016-05-12 22:15:25 PDT
The result of LayoutTests/css3/images/cross-fade-blending.html no longer matches the expected PNG file.

It seems that at intermediate stages of the blend, blending between two opaque images gives a non-opaque result, which is not what should happen.

Sadly cross-fade doesn't have any reference tests that would have caught this regression.
Comment 1 Simon Fraser (smfr) 2016-05-12 22:16:45 PDT
Created attachment 278818 [details]
Screenshot
Comment 2 Simon Fraser (smfr) 2016-05-12 22:27:44 PDT
Crossfade draws with:

    context.beginTransparencyLayer(1);

    drawCrossfadeSubimage(context, m_fromImage.get(), CompositeSourceOver, 1 - m_percentage, m_crossfadeSize);
    drawCrossfadeSubimage(context, m_toImage.get(), CompositePlusLighter, m_percentage, m_crossfadeSize);

    context.endTransparencyLayer();

which I would expect to work, unless it fails because of non-linear gamma?

It works correctly if we always go down the "useTransparencyLayer" code path.
Comment 3 Simon Fraser (smfr) 2016-05-12 22:40:39 PDT
We're dropping the blend mode on the floor (but need to fix the transparency layer case).

Probably regressed in r157045.

diff --git a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp b/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
index 57e3f1a4f1906a2669ffffdd201559cb3eb5ca16..4acfd8ad22800cf2173f1dab8a79f54c8f9092fc 100644
--- a/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
+++ b/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
@@ -51,7 +51,7 @@ static void drawCrossfadeSubimage(GraphicsContext& context, Image& image, Compos
 
     GraphicsContextStateSaver stateSaver(context);
 
-    context.setCompositeOperation(operation);
+//    context.setCompositeOperation(operation);
 
     if (useTransparencyLayer)
         context.beginTransparencyLayer(opacity);
@@ -60,7 +60,7 @@ static void drawCrossfadeSubimage(GraphicsContext& context, Image& image, Compos
 
     if (targetSize != imageSize)
         context.scale(FloatSize(targetSize.width() / imageSize.width(), targetSize.height() / imageSize.height()));
-    context.drawImage(image, IntPoint());
+    context.drawImage(image, IntPoint(), ImagePaintingOptions(operation));
 
     if (useTransparencyLayer)
         context.endTransparencyLayer();
Comment 4 Simon Fraser (smfr) 2016-05-13 14:42:05 PDT
Created attachment 278869 [details]
Patch
Comment 5 Build Bot 2016-05-13 15:00:30 PDT
Comment on attachment 278869 [details]
Patch

Attachment 278869 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1316744

Number of test failures exceeded the failure limit.
Comment 6 Build Bot 2016-05-13 15:00:33 PDT
Created attachment 278872 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 7 Simon Fraser (smfr) 2016-05-13 15:01:46 PDT
Created attachment 278873 [details]
Patch
Comment 8 Simon Fraser (smfr) 2016-05-13 15:08:48 PDT
rdar://problem/17917708
Comment 9 Build Bot 2016-05-13 15:30:09 PDT
Comment on attachment 278873 [details]
Patch

Attachment 278873 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1316839

New failing tests:
css3/images/cross-fade-blending.html
Comment 10 Build Bot 2016-05-13 15:30:13 PDT
Created attachment 278875 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 11 Build Bot 2016-05-13 15:30:21 PDT
Comment on attachment 278869 [details]
Patch

Attachment 278869 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1316835

New failing tests:
css3/images/cross-fade-blending.html
Comment 12 Build Bot 2016-05-13 15:30:25 PDT
Created attachment 278876 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 13 Build Bot 2016-05-13 15:35:34 PDT
Comment on attachment 278869 [details]
Patch

Attachment 278869 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1316831

New failing tests:
css3/images/cross-fade-blending.html
Comment 14 Build Bot 2016-05-13 15:35:38 PDT
Created attachment 278880 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 15 Simon Fraser (smfr) 2016-05-13 15:40:44 PDT
https://trac.webkit.org/r200889