Bug 156129 - toDataURL image upside down if premultipliedAlpha=false
Summary: toDataURL image upside down if premultipliedAlpha=false
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac OS X 10.11
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Blocks: 126404
  Show dependency treegraph
Reported: 2016-04-01 22:07 PDT by nkronlage
Modified: 2020-11-21 07:52 PST (History)
9 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description nkronlage 2016-04-01 22:07:18 PDT
Calling .toDataURL() on a WebGL canvas that has premultipliedAlpha set to false results in an image that upside down.

See https://jsfiddle.net/oagpgo80/ for an example.  It renders a triangle in a canvas (left) and calls toDataURL and puts the result in an <img> on the right.

Two triangles that look the same

The right triangle (the image created from toDataURL) is upside down.
Comment 1 Aleksandar Rodic 2019-08-05 07:01:24 PDT
How is it possible that such a simply bug hasn't been fixed in more than 3 years? This is still broken.
Comment 2 Radar WebKit Bug Importer 2019-08-05 08:20:35 PDT
Comment 3 William Furr 2019-12-05 11:58:42 PST
Is this something that switching to ANGLE will fix?
Comment 4 Kenneth Russell 2019-12-05 13:10:59 PST
It probably won't automatically fix it - I suspect this code path uses glReadPixels to read back the framebuffer, and that the bug is in common CPU-side code. I'm surprised there isn't a WebGL conformance test to catch this. Someone should add one to https://github.com/KhronosGroup/WebGL .
Comment 5 nkronlage 2020-06-02 15:21:11 PDT
I've added a conformance test for this to the WebGL suite: 
Comment 6 Kenneth Russell 2020-06-02 17:13:01 PDT
Thanks nkronlage@ for creating the test. Let me block the shipment of WebGL 2.0 in Safari on fixing this as well.