Skip to content

feat: paint event move texture data to handle, add colorSpace #47315

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

reitowo
Copy link
Contributor

@reitowo reitowo commented May 30, 2025

Description of Change

Breaking change for 'paint' event when shared texture offscreen is enabled, moved shared texture handle data to a unified handle property. Add colorSpace info. Split from #46811

Note that this API was marked experimental, so a breaking change should be expected by developers. Previous API put everything in root object which is not ideal.

Release Notes

Notes:

  • Added colorSpace to offscreen shared texture info of webContents.on('paint') event.
  • Breaking Changed the signature of OffscreenSharedTexture to provide a unified handle that holds the native handle.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label May 30, 2025
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jun 6, 2025
@reitowo reitowo force-pushed the main-paint-event branch from 25343d8 to f79fc72 Compare July 6, 2025 14:56
@reitowo reitowo marked this pull request as ready for review July 6, 2025 14:57
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jul 6, 2025
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jul 13, 2025
@reitowo reitowo force-pushed the main-paint-event branch 2 times, most recently from dcfb030 to 67cf1f4 Compare July 14, 2025 14:29
@erickzhao erickzhao added the semver/major incompatible API changes label Jul 24, 2025
Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

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

For the breaking change, could you add an excerpt to how to migrate usage to https://github.com/electron/electron/blob/main/docs/breaking-changes.md?

@reitowo
Copy link
Contributor Author

reitowo commented Jul 30, 2025

Sure! I added a note at breaking change. @erickzhao

@reitowo reitowo force-pushed the main-paint-event branch from 67cf1f4 to edfb89d Compare July 30, 2025 15:50
@reitowo reitowo requested a review from a team as a code owner July 30, 2025 15:50
texture.timestamp = info->timestamp.InMicroseconds();
texture.frame_count = info->metadata.capture_counter.value_or(0);
texture.capture_update_rect = info->metadata.capture_update_rect;
texture.source_size = info->metadata.source_size;
texture.region_capture_rect = info->metadata.region_capture_rect;
texture.widget_type = view_->GetWidgetType();
texture.is_webgpu_compatible = info->metadata.is_webgpu_compatible;
Copy link
Member

Choose a reason for hiding this comment

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

Are is_webgpu_compatible and supports_zero_copy_webgpu_import exposed/used anywhere? I see them being copied, but I don't see any other code that references them.

Copy link
Member

@samuelmaddock samuelmaddock left a comment

Choose a reason for hiding this comment

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

API LGTM

Breaking changes are fine given this API is already marked as experimental.

@@ -4,21 +4,15 @@
* `widgetType` string - The widget type of the texture. Can be `popup` or `frame`.
* `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`.
* `codedSize` [Size](size.md) - The full dimensions of the video frame.
* `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In OSR case, it is expected to have the full section area.
* `colorSpace` [ColorSpace](color-space.md) - The color space of the video frame.
Copy link
Member

Choose a reason for hiding this comment

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

We expose colorSpace as a string in the Display object which is a bit unfortunate. I think it's fine to expose with this struct here though. 👍
https://www.electronjs.org/docs/latest/api/structures/display

Later we can figure out whether we want to expose the struct within Display under a potentially different property name.

@reitowo reitowo force-pushed the main-paint-event branch from 23137e1 to 8ccc93d Compare July 31, 2025 19:29
@reitowo
Copy link
Contributor Author

reitowo commented Aug 2, 2025

Fixed a UTF8 BOM issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy