Hi,
attached is a patch to handle interlaced png's.
--
Johannes
Index: idirectfbimageprovider_png.c
===================================================================
RCS file: /cvs/directfb/DirectFB/interfaces/idirectfbimageprovider_png.c,v
retrieving revision 1.3
diff -c -w -r1.3 idirectfbimageprovider_png.c
*** idirectfbimageprovider_png.c 2001/05/21 20:12:57 1.3
--- idirectfbimageprovider_png.c 2001/06/01 19:43:48
***************
*** 252,261 ****
{
png_uint_32 png_width, png_height;
! int png_bpp, png_type;
png_get_IHDR( png_ptr, info_ptr, &png_width, &png_height, &png_bpp,
! &png_type, NULL, NULL, NULL );
if (png_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb( png_ptr );
--- 252,261 ----
{
png_uint_32 png_width, png_height;
! int png_bpp, png_type, number_of_passes;
png_get_IHDR( png_ptr, info_ptr, &png_width, &png_height, &png_bpp,
! &png_type, NULL /* interlace_type */, NULL, NULL );
if (png_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb( png_ptr );
***************
*** 282,293 ****
png_set_bgr( png_ptr );
#endif
if (width == png_width
&& height == png_height && BYTES_PER_PIXEL(format) == 4)
{
! while (png_height--) {
! png_read_row( png_ptr, dst, NULL );
! dst += pitch;
}
}
else {
--- 282,300 ----
png_set_bgr( png_ptr );
#endif
+ number_of_passes = png_set_interlace_handling(png_ptr);
+
if (width == png_width
&& height == png_height && BYTES_PER_PIXEL(format) == 4)
{
! /* TODO */
! while (number_of_passes--) {
! int h = png_height;
! png_bytep dest = dst;
! while (h--) {
! png_read_row( png_ptr, dest, NULL );
! dest += pitch;
! }
}
}
else {
***************
*** 299,309 ****
/* stupid libpng returns only 3 if we use the filler */
png_rowbytes = png_width*4;
! buffer = bptr = malloc( png_rowbytes * png_height );
for (i=0; i<png_height; i++) {
png_read_row( png_ptr, bptr, NULL );
bptr += png_rowbytes;
}
scale_linear_32( (__u32*)dst, (__u32*)buffer, png_width,
--- 306,319 ----
/* stupid libpng returns only 3 if we use the filler */
png_rowbytes = png_width*4;
! buffer = malloc( png_rowbytes * png_height );
+ while (number_of_passes--) {
+ bptr = buffer;
for (i=0; i<png_height; i++) {
png_read_row( png_ptr, bptr, NULL );
bptr += png_rowbytes;
+ }
}
scale_linear_32( (__u32*)dst, (__u32*)buffer, png_width,