mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
PNG: Allow support for premultiplied alpha.
LibPNG doesn't support premultiplied alpha, so now that the core supports it, we can't just say that the decoded PNG is in the core bitmap format. So we now say it's in the core pixel layout, and if it's opaque we say it has the same premultipled alpha setting as core bitmaps because the conversion is costly and makes no difference. On the other hand if it is not opaque we now admit that it is not premultipled alpha so it gets converted if needed.
This commit is contained in:
parent
c93ed6d63a
commit
4307230331
@ -538,8 +538,13 @@ png_cache_convert_error:
|
||||
}
|
||||
|
||||
if (bitmap != NULL) {
|
||||
bitmap_format_to_client((struct bitmap *)bitmap, &bitmap_fmt);
|
||||
guit->bitmap->modified((struct bitmap *)bitmap);
|
||||
bool opaque = guit->bitmap->test_opaque((void *)bitmap);
|
||||
guit->bitmap->set_opaque((void *)bitmap, opaque);
|
||||
bitmap_format_to_client((void *)bitmap, &(bitmap_fmt_t) {
|
||||
.layout = bitmap_fmt.layout,
|
||||
.pma = opaque ? bitmap_fmt.pma : false,
|
||||
});
|
||||
guit->bitmap->modified((void *)bitmap);
|
||||
}
|
||||
|
||||
return (struct bitmap *)bitmap;
|
||||
@ -566,8 +571,12 @@ static bool nspng_convert(struct content *c)
|
||||
}
|
||||
|
||||
if (png_c->bitmap != NULL) {
|
||||
guit->bitmap->set_opaque(png_c->bitmap, guit->bitmap->test_opaque(png_c->bitmap));
|
||||
bitmap_format_to_client(png_c->bitmap, &bitmap_fmt);
|
||||
bool opaque = guit->bitmap->test_opaque(png_c->bitmap);
|
||||
guit->bitmap->set_opaque(png_c->bitmap, opaque);
|
||||
bitmap_format_to_client(png_c->bitmap, &(bitmap_fmt_t) {
|
||||
.layout = bitmap_fmt.layout,
|
||||
.pma = opaque ? bitmap_fmt.pma : false,
|
||||
});
|
||||
guit->bitmap->modified(png_c->bitmap);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user