Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transparency #12561

Merged
merged 2 commits into from
Apr 10, 2018
Merged

Fix transparency #12561

merged 2 commits into from
Apr 10, 2018

Conversation

nitsakh
Copy link
Contributor

@nitsakh nitsakh commented Apr 6, 2018

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
Copy link
Contributor

@brenca brenca left a comment

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

Copy link
Contributor

@zcbenz zcbenz left a comment

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
Copy link
Member

ckerr commented Apr 10, 2018

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

@zcbenz
Copy link
Contributor

zcbenz commented Apr 11, 2018

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

@alexeykuzmin
Copy link
Contributor

/trop run backport-to 2-0-x

@alexeykuzmin
Copy link
Contributor

/trop run backport-to 1-8-x

@trop
Copy link
Contributor

trop bot commented Apr 21, 2018

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
Copy link
Contributor

trop bot commented Apr 21, 2018

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
Copy link
Contributor

trop bot commented Apr 21, 2018

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

@trop
Copy link
Contributor

trop bot commented Apr 21, 2018

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