--- a/src/Slot.cc +++ b/src/Slot.cc @@ -446,27 +446,27 @@ void Slot::loadIcon() PNG_TRANSFORM_BGR, 0 ); - if( !(info->valid & PNG_INFO_IDAT) || - !(normalicon = new int[info->width*info->height]) ) + if( !(png_get_valid( png, info, PNG_INFO_IDAT )) || + !(normalicon = new int[png_get_image_width( png, info )*png_get_image_height( png, info )]) ) throw 0; for( int y = 0, *src, *dest = normalicon; - y < info->height && (src = (int *) info->row_pointers[y]); - y++, dest += info->width ) - memcpy( dest, src, info->width<<2 ); + y < png_get_image_height( png, info ) && (src = (int *) png_get_rows( png, info )[y]); + y++, dest += png_get_image_width( png, info ) ) + memcpy( dest, src, png_get_image_width( png, info )<<2 ); - width = info->width; - height = info->height; + width = png_get_image_width( png, info ); + height = png_get_image_height( png, info ); // convert grayscale image to rgb - if( info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) - for( int y = info->height, *line = normalicon; - --y; line += info->width ) + if( png_get_color_type( png, info ) == PNG_COLOR_TYPE_GRAY_ALPHA ) + for( int y = png_get_image_height( png, info ), *line = normalicon; + --y; line += png_get_image_width( png, info ) ) { - unsigned char *dest = (unsigned char *) line+(info->width<<2); - unsigned char *src = (unsigned char *) line+(info->width<<1); + unsigned char *dest = (unsigned char *) line+(png_get_image_width( png, info )<<2); + unsigned char *src = (unsigned char *) line+(png_get_image_width( png, info )<<1); - for( int x = info->width; --x; ) + for( int x = png_get_image_width( png, info ); --x; ) { *(--dest) = *(--src); *(--dest) = *(--src);