mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-21 08:58:37 +03:00
fix(wuffs): don't premul alpha when loading images
It seems like the raw data version of the kitty graphics transmit operation is meant to be unassociated (aka straight) alpha, though I can't find any definitive documentation either way- but in any case unassociated alpha is more common in image formats and makes the handling easier for the rest of it. Also removed a redundant call to `decode_frame_config`, since it's called implicitly when we call `decode_frame` right after.
This commit is contained in:
@ -55,7 +55,7 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData {
|
|||||||
|
|
||||||
c.wuffs_base__pixel_config__set(
|
c.wuffs_base__pixel_config__set(
|
||||||
&image_config.pixcfg,
|
&image_config.pixcfg,
|
||||||
c.WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL,
|
c.WUFFS_BASE__PIXEL_FORMAT__RGBA_NONPREMUL,
|
||||||
c.WUFFS_BASE__PIXEL_SUBSAMPLING__NONE,
|
c.WUFFS_BASE__PIXEL_SUBSAMPLING__NONE,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
@ -95,16 +95,6 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData {
|
|||||||
try check(log, &status);
|
try check(log, &status);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frame_config: c.wuffs_base__frame_config = undefined;
|
|
||||||
{
|
|
||||||
const status = c.wuffs_jpeg__decoder__decode_frame_config(
|
|
||||||
decoder,
|
|
||||||
&frame_config,
|
|
||||||
&source_buffer,
|
|
||||||
);
|
|
||||||
try check(log, &status);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const status = c.wuffs_jpeg__decoder__decode_frame(
|
const status = c.wuffs_jpeg__decoder__decode_frame(
|
||||||
decoder,
|
decoder,
|
||||||
|
@ -55,7 +55,7 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData {
|
|||||||
|
|
||||||
c.wuffs_base__pixel_config__set(
|
c.wuffs_base__pixel_config__set(
|
||||||
&image_config.pixcfg,
|
&image_config.pixcfg,
|
||||||
c.WUFFS_BASE__PIXEL_FORMAT__RGBA_PREMUL,
|
c.WUFFS_BASE__PIXEL_FORMAT__RGBA_NONPREMUL,
|
||||||
c.WUFFS_BASE__PIXEL_SUBSAMPLING__NONE,
|
c.WUFFS_BASE__PIXEL_SUBSAMPLING__NONE,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
@ -95,16 +95,6 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData {
|
|||||||
try check(log, &status);
|
try check(log, &status);
|
||||||
}
|
}
|
||||||
|
|
||||||
var frame_config: c.wuffs_base__frame_config = undefined;
|
|
||||||
{
|
|
||||||
const status = c.wuffs_png__decoder__decode_frame_config(
|
|
||||||
decoder,
|
|
||||||
&frame_config,
|
|
||||||
&source_buffer,
|
|
||||||
);
|
|
||||||
try check(log, &status);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const status = c.wuffs_png__decoder__decode_frame(
|
const status = c.wuffs_png__decoder__decode_frame(
|
||||||
decoder,
|
decoder,
|
||||||
|
Reference in New Issue
Block a user