diff options
Diffstat (limited to 'chat/amsn')
-rw-r--r-- | chat/amsn/distinfo | 4 | ||||
-rw-r--r-- | chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp | 122 |
2 files changed, 87 insertions, 39 deletions
diff --git a/chat/amsn/distinfo b/chat/amsn/distinfo index b8283f461ea..a58874769d5 100644 --- a/chat/amsn/distinfo +++ b/chat/amsn/distinfo @@ -1,8 +1,8 @@ -$NetBSD: distinfo,v 1.7 2011/04/03 15:26:36 wiz Exp $ +$NetBSD: distinfo,v 1.8 2011/08/01 00:43:58 dholland Exp $ SHA1 (amsn-0.98.3-src.tar.bz2) = aa8383a11ce66352aceee27f9c291c1410b3403d RMD160 (amsn-0.98.3-src.tar.bz2) = 20f707062da4a5ab1eb6beec49d01dfd2ba90a99 Size (amsn-0.98.3-src.tar.bz2) = 13275477 bytes SHA1 (patch-configure) = ddbd6a9616683c44202a551d734b2c9b10b2e05b -SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.cpp) = f8b7695ec8b5ce5730490fefc5f2e4b3d7e44e8a +SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.cpp) = 2dfad18af89fb7f5ec4e316bfc35f6ed40377e10 SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.h) = 1d7a1cc0acd397629a0e6b1f83f9fdf943fb6d8a diff --git a/chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp b/chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp index 5999298b7e6..ef87f297fc9 100644 --- a/chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp +++ b/chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp @@ -1,4 +1,4 @@ -$NetBSD: patch-utils_TkCximage_src_CxImage_ximapng.cpp,v 1.1 2011/04/03 15:26:36 wiz Exp $ +$NetBSD: patch-utils_TkCximage_src_CxImage_ximapng.cpp,v 1.2 2011/08/01 00:43:58 dholland Exp $ Fix build with png-1.5. @@ -192,16 +192,20 @@ Fix build with png-1.5. // turn on interlace handling int number_passes = png_set_interlace_handling(png_ptr); -@@ -221,7 +220,7 @@ bool CxImagePNG::Decode(CxFile *hFile) +@@ -221,8 +220,10 @@ bool CxImagePNG::Decode(CxFile *hFile) SetCodecOption(0); } - int chan_offset = info_ptr->bit_depth >> 3; -+ int chan_offset = png_get_bit_depth(png_ptr, info_ptr) >> 3; - int pixel_offset = info_ptr->pixel_depth >> 3; +- int pixel_offset = info_ptr->pixel_depth >> 3; ++ int bit_depth = png_get_bit_depth(png_ptr, info_ptr); ++ int chan_offset = bit_depth >> 3; ++ //int pixel_offset = info_ptr->pixel_depth >> 3; ++ int pixel_offset = (bit_depth * channels) >> 3; for (int pass=0; pass < number_passes; pass++) { -@@ -230,7 +229,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + iter.Upset(); +@@ -230,7 +231,7 @@ bool CxImagePNG::Decode(CxFile *hFile) do { // <vho> - handle cancel @@ -210,16 +214,30 @@ Fix build with png-1.5. #if CXIMAGE_SUPPORT_ALPHA // <vho> if (AlphaIsValid()) { -@@ -281,7 +280,7 @@ bool CxImagePNG::Decode(CxFile *hFile) - if (info_ptr->interlace_type && pass>0){ - iter.GetRow(row_pointers, info_ptr->rowbytes); +@@ -241,7 +242,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + BYTE* prow= iter.GetRow(ay); + + //recover data from previous scan +- if (info_ptr->interlace_type && pass>0 && pass!=7){ ++ if (png_get_interlace_type(png_ptr, info_ptr) && pass>0 && pass!=7){ + for(ax=0;ax<head.biWidth;ax++){ + long px = ax * pixel_offset; + if (channels == 2){ +@@ -278,10 +279,10 @@ bool CxImagePNG::Decode(CxFile *hFile) + #endif // CXIMAGE_SUPPORT_ALPHA // vho + { + //recover data from previous scan +- if (info_ptr->interlace_type && pass>0){ +- iter.GetRow(row_pointers, info_ptr->rowbytes); ++ if (png_get_interlace_type(png_ptr, info_ptr) && pass>0){ ++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr, info_ptr)); //re-expand buffer for images with bit depth > 8 - if (info_ptr->bit_depth > 8){ + if (png_get_bit_depth(png_ptr, info_ptr) > 8){ for(long ax=(head.biWidth*channels-1);ax>=0;ax--) row_pointers[ax*chan_offset] = row_pointers[ax]; } -@@ -291,7 +290,7 @@ bool CxImagePNG::Decode(CxFile *hFile) +@@ -291,15 +292,15 @@ bool CxImagePNG::Decode(CxFile *hFile) png_read_row(png_ptr, row_pointers, NULL); //shrink 16 bit depth images down to 8 bits @@ -228,16 +246,29 @@ Fix build with png-1.5. for(long ax=0;ax<(head.biWidth*channels);ax++) row_pointers[ax] = row_pointers[ax*chan_offset]; } -@@ -299,7 +298,7 @@ bool CxImagePNG::Decode(CxFile *hFile) + //copy the pixels - iter.SetRow(row_pointers, info_ptr->rowbytes); +- iter.SetRow(row_pointers, info_ptr->rowbytes); ++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr, info_ptr)); //<DP> expand 2 bpp images only in the last pass - if (info_ptr->bit_depth==2 && pass==(number_passes-1)) + if (png_get_bit_depth(png_ptr, info_ptr)==2 && pass==(number_passes-1)) expand2to4bpp(iter.GetRow()); //go on -@@ -362,7 +361,7 @@ bool CxImagePNG::Encode(CxFile *hFile) +@@ -340,6 +341,11 @@ bool CxImagePNG::Encode(CxFile *hFile) + BYTE trans[256]; //for transparency (don't move) + png_struct *png_ptr; + png_info *info_ptr; ++ png_uint_32 width, height; ++ png_byte bit_depth; ++ png_byte color_type; ++ png_byte interlace_type; ++ BYTE channels; + + cx_try + { +@@ -362,7 +368,7 @@ bool CxImagePNG::Encode(CxFile *hFile) /* Set error handling. REQUIRED if you aren't supplying your own * error hadnling functions in the png_create_write_struct() call. */ @@ -246,58 +277,73 @@ Fix build with png-1.5. /* If we get here, we had a problem reading the file */ if (info_ptr->palette) free(info_ptr->palette); png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr); -@@ -376,11 +375,11 @@ bool CxImagePNG::Encode(CxFile *hFile) +@@ -376,20 +382,18 @@ bool CxImagePNG::Encode(CxFile *hFile) png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); /* set the file information here */ - info_ptr->width = GetWidth(); -+ png_get_image_width(png_ptr, info_ptr) = GetWidth(); - info_ptr->height = GetHeight(); - info_ptr->pixel_depth = (BYTE)GetBpp(); +- info_ptr->height = GetHeight(); +- info_ptr->pixel_depth = (BYTE)GetBpp(); - info_ptr->channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1; - info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels); -+ png_get_channels(png_ptr, info_ptr) = (GetBpp()>8) ? (BYTE)3: (BYTE)1; -+ png_get_bit_depth(png_ptr, info_ptr) = (BYTE)(GetBpp()/png_get_channels(png_ptr, info_ptr)); - info_ptr->compression_type = info_ptr->filter_type = 0; - info_ptr->valid = 0; +- info_ptr->compression_type = info_ptr->filter_type = 0; +- info_ptr->valid = 0; ++ width = GetWidth(); ++ height = GetHeight(); ++ //pixel_depth = (BYTE)GetBpp(); ++ channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1; ++ bit_depth = (BYTE)(GetBpp()/channels); -@@ -399,18 +398,18 @@ bool CxImagePNG::Encode(CxFile *hFile) + switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){ + case 1: +- info_ptr->interlace_type = PNG_INTERLACE_ADAM7; ++ interlace_type = PNG_INTERLACE_ADAM7; + break; + default: +- info_ptr->interlace_type = PNG_INTERLACE_NONE; ++ interlace_type = PNG_INTERLACE_NONE; + } + + /* set compression level */ +@@ -399,19 +403,19 @@ bool CxImagePNG::Encode(CxFile *hFile) if (GetNumColors()){ if (bGrayScale){ - info_ptr->color_type = PNG_COLOR_TYPE_GRAY; -+ png_get_color_type(png_ptr, info_ptr) = PNG_COLOR_TYPE_GRAY; ++ color_type = PNG_COLOR_TYPE_GRAY; } else { - info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; -+ png_get_color_type(png_ptr, info_ptr) = PNG_COLOR_TYPE_PALETTE; ++ color_type = PNG_COLOR_TYPE_PALETTE; } } else { - info_ptr->color_type = PNG_COLOR_TYPE_RGB; -+ png_get_color_type(png_ptr, info_ptr) = PNG_COLOR_TYPE_RGB; ++ color_type = PNG_COLOR_TYPE_RGB; } #if CXIMAGE_SUPPORT_ALPHA if (AlphaIsValid()){ - info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; - info_ptr->channels++; - info_ptr->bit_depth = 8; -+ png_get_color_type(png_ptr, info_ptr) |= PNG_COLOR_MASK_ALPHA; -+ png_get_channels(png_ptr, info_ptr)++; -+ png_get_bit_depth(png_ptr, info_ptr) = 8; - info_ptr->pixel_depth += 8; +- info_ptr->pixel_depth += 8; ++ color_type |= PNG_COLOR_MASK_ALPHA; ++ channels++; ++ bit_depth = 8; ++ //pixel_depth += 8; } #endif -@@ -428,8 +427,8 @@ bool CxImagePNG::Encode(CxFile *hFile) + +@@ -428,8 +432,8 @@ bool CxImagePNG::Encode(CxFile *hFile) /* set metrics */ png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER); - png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth, - info_ptr->color_type, info_ptr->interlace_type, -+ png_set_IHDR(png_ptr, info_ptr, png_get_image_width(png_ptr, info_ptr), info_ptr->height, png_get_bit_depth(png_ptr, info_ptr), -+ png_get_color_type(png_ptr, info_ptr), info_ptr->interlace_type, ++ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, ++ color_type, interlace_type, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); //<DP> simple transparency -@@ -469,13 +468,7 @@ bool CxImagePNG::Encode(CxFile *hFile) +@@ -469,13 +473,7 @@ bool CxImagePNG::Encode(CxFile *hFile) if (info.bAlphaPaletteEnabled){ for(WORD ip=0; ip<nc;ip++) trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved; @@ -312,16 +358,18 @@ Fix build with png-1.5. } // copy the palette colors -@@ -496,7 +489,7 @@ bool CxImagePNG::Encode(CxFile *hFile) +@@ -496,8 +494,8 @@ bool CxImagePNG::Encode(CxFile *hFile) } } } #endif // CXIMAGE_SUPPORT_ALPHA // <vho> - int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8)); -+ int row_size = max(info.dwEffWidth, png_get_image_width(png_ptr, info_ptr)*png_get_channels(png_ptr, info_ptr)*(png_get_bit_depth(png_ptr, info_ptr)/8)); - info_ptr->rowbytes = row_size; +- info_ptr->rowbytes = row_size; ++ int row_size = max(info.dwEffWidth, png_get_rowbytes(png_ptr, info_ptr)); ++ //info_ptr->rowbytes = row_size; BYTE *row_pointers = new BYTE[row_size]; -@@ -515,7 +508,7 @@ bool CxImagePNG::Encode(CxFile *hFile) + /* write the file information */ +@@ -515,7 +513,7 @@ bool CxImagePNG::Encode(CxFile *hFile) if (AlphaIsValid()){ for (long ax=head.biWidth-1; ax>=0;ax--){ c = BlindGetPixelColor(ax,ay); @@ -330,7 +378,7 @@ Fix build with png-1.5. if (!bGrayScale){ row_pointers[px++]=c.rgbRed; row_pointers[px++]=c.rgbGreen; -@@ -530,7 +523,7 @@ bool CxImagePNG::Encode(CxFile *hFile) +@@ -530,7 +528,7 @@ bool CxImagePNG::Encode(CxFile *hFile) #endif //CXIMAGE_SUPPORT_ALPHA // <vho> { iter.GetRow(row_pointers, row_size); |