Skip to content

fix: premuliplied alpha blending#202

Merged
dsh0416 merged 1 commit into
mainfrom
dsh0416/alpha-fix
May 24, 2026
Merged

fix: premuliplied alpha blending#202
dsh0416 merged 1 commit into
mainfrom
dsh0416/alpha-fix

Conversation

@dsh0416

@dsh0416 dsh0416 commented May 24, 2026

Copy link
Copy Markdown
Owner
  • Display CEF browser textures with premultiplied-alpha blending to avoid color shifts on transparent/antialiased content.
  • Apply the same premultiplied-alpha material to accelerated popup overlays.

Copilot AI review requested due to automatic review settings May 24, 2026 10:23

Copilot AI 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.

Pull request overview

Adjusts how CefTexture (and its accelerated popup overlay) is rendered in Godot by applying premultiplied-alpha blending, aiming to eliminate color fringes/shifts around transparent/antialiased browser content.

Changes:

  • Introduces a helper to create a CanvasItemMaterial configured for PREMULT_ALPHA blending.
  • Applies the premultiplied-alpha material to the main CefTexture TextureRect during READY.
  • Applies the same premultiplied-alpha material to the accelerated popup overlay TextureRect.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/gdcef/src/cef_texture/mod.rs Adds a premultiplied-alpha CanvasItemMaterial helper and assigns it to the main CefTexture node on ready.
crates/gdcef/src/cef_texture/rendering.rs Assigns the premultiplied-alpha material to the accelerated popup overlay TextureRect.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.with_app_mut(|app| app.mark_cef_retained());

self.base_mut().set_expand_mode(ExpandMode::IGNORE_SIZE);
self.base_mut().set_material(&Self::make_browser_material());
Comment on lines 155 to +157
let mut overlay = TextureRect::new_alloc();
overlay.set_expand_mode(ExpandMode::IGNORE_SIZE);
overlay.set_material(&Self::make_browser_material());
@dsh0416 dsh0416 merged commit c138e7e into main May 24, 2026
24 checks passed
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.

2 participants