Skip to content

Commit 140a5cb

Browse files
authored
Don't report CoreGraphics as supporting premultiplied alpha (#356)
It doesn't really support it, the alpha value seems to be clamped.
1 parent 710eb65 commit 140a5cb

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/backends/cg.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,12 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
284284
}
285285

286286
#[inline]
287-
fn supports_alpha_mode(&self, _alpha_mode: AlphaMode) -> bool {
288-
true
287+
fn supports_alpha_mode(&self, alpha_mode: AlphaMode) -> bool {
288+
// Premultiplied doesn't seem to work, at least not with transparent windows.
289+
matches!(
290+
alpha_mode,
291+
AlphaMode::Ignored | AlphaMode::Opaque | AlphaMode::Postmultiplied
292+
)
289293
}
290294

291295
fn configure(

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,10 @@ pub enum AlphaMode {
641641
/// ## Platform Dependent Behavior
642642
///
643643
/// - Wayland and DRM/KMS: Supported.
644-
/// - macOS/iOS: Supported, but currently doesn't work with additive values (maybe only as the
645-
/// root layer?). Will be fixed by <https://github.com/rust-windowing/softbuffer/pull/329>.
646644
/// - Web: Not yet supported (TODO `ImageBitmap`).
647645
/// - Android, Orbital, Windows and X11: Not supported (yet unknown if they can be, feel
648646
/// free to open an issue about it).
647+
/// - macOS/iOS: Not supported (doesn't seem to work with additive values).
649648
#[doc(alias = "Associated")]
650649
Premultiplied,
651650
/// The non-alpha channels are not expected to already be multiplied by the alpha channel;

0 commit comments

Comments
 (0)