mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
libpng: interlaced support
This commit is contained in:
parent
3f0e4f3718
commit
7a3827395c
@ -158,18 +158,21 @@ s32 PS4_SYSV_ABI scePngDecDecode(OrbisPngDecHandle handle, const OrbisPngDecDeco
|
|||||||
color_type == PNG_COLOR_TYPE_PALETTE)
|
color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_add_alpha(pngh->png_ptr, param->alphaValue, PNG_FILLER_AFTER);
|
png_set_add_alpha(pngh->png_ptr, param->alphaValue, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
|
int pass = png_set_interlace_handling(pngh->png_ptr);
|
||||||
png_read_update_info(pngh->png_ptr, pngh->info_ptr);
|
png_read_update_info(pngh->png_ptr, pngh->info_ptr);
|
||||||
|
|
||||||
auto ptr = (png_bytep)param->imageMemAddr;
|
|
||||||
|
|
||||||
auto const numChannels = png_get_channels(pngh->png_ptr, pngh->info_ptr);
|
auto const numChannels = png_get_channels(pngh->png_ptr, pngh->info_ptr);
|
||||||
auto horizontal_bytes = numChannels * width;
|
auto horizontal_bytes = numChannels * width;
|
||||||
|
|
||||||
int stride = param->imagePitch > 0 ? param->imagePitch : horizontal_bytes;
|
int stride = param->imagePitch > 0 ? param->imagePitch : horizontal_bytes;
|
||||||
|
|
||||||
|
for (int j = 0; j < pass; j++) { // interlaced
|
||||||
|
auto ptr = (png_bytep)param->imageMemAddr;
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
png_read_row(pngh->png_ptr, ptr, NULL);
|
png_read_row(pngh->png_ptr, ptr, nullptr);
|
||||||
ptr += stride;
|
ptr += stride;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (width > 32767 || height > 32767) ? 0 : (width << 16) | height;
|
return (width > 32767 || height > 32767) ? 0 : (width << 16) | height;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user