LibGfx: Report premultiplied alpha type for opaque Skia surfaces

We don't discern between opaque and non-opaque alpha types in LibGfx,
which at some point we might need to do. But for now, assume all opaque
Skia surfaces have premultiplied alpha.

Fixes #6892.
This commit is contained in:
Jelle Raaijmakers
2025-11-25 09:45:35 +01:00
committed by Jelle Raaijmakers
parent 6790a695da
commit 3b7eede694
Notes: github-actions[bot] 2025-11-26 08:26:02 +00:00
4 changed files with 17 additions and 3 deletions

View File

@@ -41,9 +41,11 @@ IntSize ImmutableBitmap::size() const
return { width(), height() };
}
Gfx::AlphaType ImmutableBitmap::alpha_type() const
AlphaType ImmutableBitmap::alpha_type() const
{
return m_impl->sk_image->alphaType() == kPremul_SkAlphaType ? Gfx::AlphaType::Premultiplied : Gfx::AlphaType::Unpremultiplied;
// We assume premultiplied alpha type for opaque surfaces since that is Skia's preferred alpha type and the
// effective pixel data is identical between premultiplied and unpremultiplied in that case.
return m_impl->sk_image->alphaType() == kUnpremul_SkAlphaType ? AlphaType::Unpremultiplied : AlphaType::Premultiplied;
}
SkImage const* ImmutableBitmap::sk_image() const