Skip to content

Fix white flash when takePlayerScreenShot is used with CEF browsers#5004

Open
QueryOfficial wants to merge 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/cef-screenshot-white-flash
Open

Fix white flash when takePlayerScreenShot is used with CEF browsers#5004
QueryOfficial wants to merge 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/cef-screenshot-white-flash

Conversation

@QueryOfficial

Copy link
Copy Markdown

Summary

Remove the pre/post screenshot hooks that cleared live CEF render targets before takePlayerScreenShot capture. The back buffer is now grabbed as-is after DrawPreGUIQueue, eliminating the visible white flash when a CEF browser is on screen.

Also removes the now-unused OnPreScreenshot, OnPostScreenshot, ClearTextures, and ClearTexture code paths.

Motivation

When the server calls takePlayerScreenShot while a client has a CEF browser displayed via createBrowser + dxDrawImage, the player's screen briefly flashes white on every capture.

The old flow cleared live CEF textures to white (0xFF) before reading the back buffer, then triggered an async Invalidate to repaint them. That touched the same textures used for on-screen rendering in the same frame, so the flash was visible to the player.

This change captures the back buffer without modifying live CEF textures. Screenshot upload continues to work; only the visible flash is removed.

Fixes #4955

Test plan

Create a CEF browser on the client and draw it with dxDrawImage. Call takePlayerScreenShot from the server repeatedly and confirm no white flash appears on the client.

Confirm the server still receives the screenshot with correct game content.

Test downscaled capture with takePlayerScreenShot(player, 320, 240, ...).

Regression: F12 local screenshot still works.

Regression: alt-tab / minimized client still returns MINIMIZED / DISABLED responses as before.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

…e clearing methods

This commit removes the OnPreScreenshot, OnPostScreenshot, and ClearTextures methods from CWebCore and CWebView classes. The changes streamline the code by eliminating unused functionality related to screenshot processing and texture management, improving overall maintainability.
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.

takePlayerScreenShot causes white flash when a CEF browser is rendered

1 participant