Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@robert-ancell
Copy link
Contributor

@robert-ancell robert-ancell commented Aug 16, 2024

Note when using a transparent background from Flutter and using
glBlitFramebuffer the background is not shown, and instead the
background is always black. This may mean we cannot use
glBlitFramebuffer in this case.

Setting the background color with an alpha value less than 1.0
doesn't currently show the GTK background. This needs more
investigation.

The above two issues will tracked as separate issues/fixes.

Fixes flutter/flutter#149920
@robert-ancell
Copy link
Contributor Author

To enable this is an application edit my_application.cc and add code like:

GdkRGBA background_color;
gdk_rgba_parse(&background_color, "#ff0000");
fl_view_set_background_color(view, &background_color);

@robert-ancell
Copy link
Contributor Author

This doesn't solve all the issues with background, but might be useful for those who want to immediately minimize the black background shown when an application starts.

@robert-ancell
Copy link
Contributor Author

@loic-sharma this might also affect the Windows embedder - it seems like you should be allowed to set the background for an app (e.g. red) and Flutter can have a transparent background (e.g. with scaffoldBackgroundColor: Colors.transparent in ThemeData). In that case we can't use glBlitFramebuffer to render this correctly and must use textures and shaders to do this. However, this is probably not the common case for Flutter apps, is it possible for Flutter to indicate if any content has alpha? The other case is presenting multiple layers - I'm currently blitting those but in general should they also be assumed to contain alpha content?

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM

@loic-sharma
Copy link
Member

@loic-sharma this might also affect the Windows embedder - it seems like you should be allowed to set the background for an app (e.g. red) and Flutter can have a transparent background (e.g. with scaffoldBackgroundColor: Colors.transparent in ThemeData). In that case we can't use glBlitFramebuffer to render this correctly and must use textures and shaders to do this. However, this is probably not the common case for Flutter apps, is it possible for Flutter to indicate if any content has alpha? The other case is presenting multiple layers - I'm currently blitting those but in general should they also be assumed to contain alpha content?

Agreed. We'll definitely need to fix this before we can support platform views on Windows.

@robert-ancell
Copy link
Contributor Author

The bug with the background not showing through is a bug in GTK version in Ubuntu, which is fixed upstream. So I've re-enabled the transparency in this change.

@robert-ancell
Copy link
Contributor Author

Interestingly when using a fixed version of GTK, the blit does seem to work with alpha. I'm not sure if that's correct OpenGL behaviour or driver specific.

@robert-ancell robert-ancell merged commit 9d7e3a6 into flutter:main Aug 19, 2024
@robert-ancell robert-ancell deleted the linux-set-background-color branch August 19, 2024 20:00
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 19, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 19, 2024
…153724)

flutter/engine@30ffbfa...9d7e3a6

2024-08-19 [email protected] Allow the default background color to be changed (flutter/engine#54575)
2024-08-19 [email protected] Roll Skia from d528658273db to 318b7958f748 (4 revisions) (flutter/engine#54620)
2024-08-19 [email protected] [Impeller] use paragraphs instead of bullet points in the FAQ. (flutter/engine#54622)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@robert-ancell
Copy link
Contributor Author

Talking to another developer the Blit alpha behaviour might be Mesa specific, so when testing on NVIDIA it might not work.

Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…lutter#153724)

flutter/engine@30ffbfa...9d7e3a6

2024-08-19 [email protected] Allow the default background color to be changed (flutter/engine#54575)
2024-08-19 [email protected] Roll Skia from d528658273db to 318b7958f748 (4 revisions) (flutter/engine#54620)
2024-08-19 [email protected] [Impeller] use paragraphs instead of bullet points in the FAQ. (flutter/engine#54622)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The native background color on Linux should be overridable

3 participants