Skip to content

Fix transparency - #12561

Merged
zcbenz merged 2 commits into
electron:masterfrom
nitsakh:fix-transparency
Apr 10, 2018
Merged

zcbenz merged 2 commits into
electron:masterfrom
nitsakh:fix-transparency

Conversation

@nitsakh

@nitsakh nitsakh commented Apr 6, 2018

Copy link
Copy Markdown
Contributor

This fixes #12308.

With the latest chromium, the problem is consistent, i.e. the unscaled capture PNG also did not have transparency. The real fix for this would be to fix it in chromium, DelegatedFrameHost::CopyFromCompositingSurface by specifying the result format as RGBA_BITMAP. Currently, the result format is RGBA_TEXTURE, which causes the issue.
However, chromium is currently making changes and the breaking code path will be going away completely soon (https://bugs.chromium.org/p/chromium/issues/detail?id=759310).
So, for the time being, lets do a hack to preserve the transparency.(thanks to @brenca for this one)

The test creates a browser window with transparent background and captures that into a PNG.
We check the PNG header to make sure that the alpha channel is present in the PNG.

@nitsakh
nitsakh requested a review from a team April 6, 2018 22:23

@brenca brenca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from me, but I'm biased :D

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@zcbenz
zcbenz merged commit 6fc819d into electron:master Apr 10, 2018
@ckerr

ckerr commented Apr 10, 2018

Copy link
Copy Markdown
Member

@zcbenz should this be tropped to 2-0-x and 1-8-x?

@zcbenz

zcbenz commented Apr 11, 2018

Copy link
Copy Markdown
Contributor

@ckerr Looking at the original issue it seems that we should backport this.

@alexeykuzmin

Copy link
Copy Markdown
Contributor

/trop run backport-to 2-0-x

@alexeykuzmin

Copy link
Copy Markdown
Contributor

/trop run backport-to 1-8-x

@trop

trop Bot commented Apr 21, 2018

Copy link
Copy Markdown
Contributor

The backport process for this PR has been manually initiated, sending your 1's and 0's to "2-0-x" here we go! :D

@trop

trop Bot commented Apr 21, 2018

Copy link
Copy Markdown
Contributor

The backport process for this PR has been manually initiated, sending your 1's and 0's to "1-8-x" here we go! :D

@trop

trop Bot commented Apr 21, 2018

Copy link
Copy Markdown
Contributor

We have automatically backported this PR to "2-0-x", please check out #12683

@trop

trop Bot commented Apr 21, 2018

Copy link
Copy Markdown
Contributor

We have automatically backported this PR to "1-8-x", please check out #12684

@trop trop Bot added the merged/1-8-x label Apr 21, 2018
@nitsakh
nitsakh deleted the fix-transparency branch June 29, 2018 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transparency from browserWindow.capturePage is lost after calling nativeImage.resize

5 participants