Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ef034fae5 | ||
|
|
c72a884778 | ||
|
|
eaae142ebb | ||
|
|
b323e027a4 | ||
|
|
949e69d9b7 | ||
|
|
21232dff69 |
6 changed files with 64 additions and 601 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
amsn-0.98.3-src.tar.bz2
|
||||
/amsn-0.98.4-src.tar.bz2
|
||||
/amsn-0.98.9-src.tar.bz2
|
||||
|
|
|
|||
|
|
@ -1,498 +0,0 @@
|
|||
--- amsn/utils/TkCximage/src/CxImage/ximapng.cpp 2012/01/14 15:27:06 12356
|
||||
+++ amsn/utils/TkCximage/src/CxImage/ximapng.cpp 2012/01/24 21:21:23 12357
|
||||
@@ -15,7 +15,7 @@
|
||||
void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
|
||||
{
|
||||
strcpy(info.szLastError,message);
|
||||
- longjmp(png_ptr->jmpbuf, 1);
|
||||
+ longjmp(png_jmpbuf(png_ptr), 1);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if CXIMAGE_SUPPORT_DECODE
|
||||
@@ -59,10 +59,10 @@
|
||||
cx_throw("Failed to initialize PNG info structure");
|
||||
}
|
||||
|
||||
- /* Set error handling if you are using the setjmp/longjmp method (this is
|
||||
- * the normal method of doing things with libpng). REQUIRED unless you
|
||||
- * set up your own error handlers in the png_create_read_struct() earlier. */
|
||||
- if (setjmp(png_ptr->jmpbuf)) {
|
||||
+ /* Set error handling if you are using the setjmp/longjmp method (this is
|
||||
+ * the normal method of doing things with libpng). REQUIRED unless you
|
||||
+ * set up your own error handlers in the png_create_read_struct() earlier. */
|
||||
+ if (setjmp(png_jmpbuf(png_ptr))) {
|
||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||
delete [] row_pointers;
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
||||
@@ -70,22 +70,22 @@
|
||||
}
|
||||
|
||||
// use custom I/O functions
|
||||
- png_set_read_fn(png_ptr, hFile, /*(png_rw_ptr)*/user_read_data);
|
||||
+ png_set_read_fn(png_ptr, hFile, /*(png_rw_ptr)*/user_read_data);
|
||||
png_set_error_fn(png_ptr,info.szLastError,/*(png_error_ptr)*/user_error_fn,NULL);
|
||||
|
||||
/* read the file information */
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
if (info.nEscape == -1){
|
||||
- head.biWidth = info_ptr->width;
|
||||
- head.biHeight= info_ptr->height;
|
||||
+ head.biWidth = png_get_image_width(png_ptr, info_ptr);
|
||||
+ head.biHeight= png_get_image_height(png_ptr, info_ptr);
|
||||
info.dwType = CXIMAGE_FORMAT_PNG;
|
||||
- longjmp(png_ptr->jmpbuf, 1);
|
||||
+ longjmp(png_jmpbuf(png_ptr), 1);
|
||||
}
|
||||
|
||||
/* calculate new number of channels */
|
||||
int channels=0;
|
||||
- switch(info_ptr->color_type){
|
||||
+ switch(png_get_color_type(png_ptr, info_ptr)){
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
channels = 1;
|
||||
@@ -101,97 +101,106 @@
|
||||
break;
|
||||
default:
|
||||
strcpy(info.szLastError,"unknown PNG color type");
|
||||
- longjmp(png_ptr->jmpbuf, 1);
|
||||
+ longjmp(png_jmpbuf(png_ptr), 1);
|
||||
}
|
||||
|
||||
//find the right pixel depth used for cximage
|
||||
- int pixel_depth = info_ptr->pixel_depth;
|
||||
+ int pixel_depth = png_get_bit_depth(png_ptr, info_ptr)
|
||||
+ * png_get_channels(png_ptr, info_ptr);
|
||||
if (channels == 1 && pixel_depth>8) pixel_depth=8;
|
||||
if (channels == 2) pixel_depth=8;
|
||||
- if (channels >= 3) pixel_depth=24;
|
||||
+ if (channels >= 3) pixel_depth=32;
|
||||
|
||||
- if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
|
||||
- longjmp(png_ptr->jmpbuf, 1);
|
||||
+ if (!Create(png_get_image_width(png_ptr, info_ptr),
|
||||
+ png_get_image_height(png_ptr, info_ptr),
|
||||
+ pixel_depth, CXIMAGE_FORMAT_PNG)){
|
||||
+ longjmp(png_jmpbuf(png_ptr), 1);
|
||||
}
|
||||
|
||||
/* get metrics */
|
||||
- switch (info_ptr->phys_unit_type)
|
||||
+ png_uint_32 res_x, res_y;
|
||||
+ int phys_unit_type;
|
||||
+
|
||||
+ png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, &phys_unit_type);
|
||||
+ switch (phys_unit_type)
|
||||
{
|
||||
case PNG_RESOLUTION_UNKNOWN:
|
||||
- SetXDPI(info_ptr->x_pixels_per_unit);
|
||||
- SetYDPI(info_ptr->y_pixels_per_unit);
|
||||
+ SetXDPI(res_x);
|
||||
+ SetYDPI(res_y);
|
||||
break;
|
||||
case PNG_RESOLUTION_METER:
|
||||
- SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
|
||||
- SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
|
||||
+ SetXDPI((long)floor(res_x * 254.0 / 10000.0 + 0.5));
|
||||
+ SetYDPI((long)floor(res_y * 254.0 / 10000.0 + 0.5));
|
||||
break;
|
||||
}
|
||||
|
||||
- if (info_ptr->num_palette>0){
|
||||
- SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
|
||||
- SetClrImportant(info_ptr->num_palette);
|
||||
- } else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
|
||||
+ int num_palette = -1;
|
||||
+ png_colorp palette;
|
||||
+ if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) {
|
||||
+ SetPalette((rgb_color*)&palette, num_palette);
|
||||
+ SetClrImportant(num_palette);
|
||||
+ } else if (png_get_bit_depth(png_ptr, info_ptr)==2) { //<DP> needed for 2 bpp grayscale PNGs
|
||||
SetPaletteColor(0,0,0,0);
|
||||
SetPaletteColor(1,85,85,85);
|
||||
SetPaletteColor(2,170,170,170);
|
||||
SetPaletteColor(3,255,255,255);
|
||||
- } else SetGrayPalette(); //<DP> needed for grayscale PNGs
|
||||
+ } else {
|
||||
+ SetGrayPalette(); //<DP> needed for grayscale PNGs
|
||||
+ }
|
||||
|
||||
- int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
|
||||
+ int nshift = max(0,(png_get_bit_depth(png_ptr, info_ptr)>>3)-1)<<3;
|
||||
|
||||
- if (info_ptr->num_trans!=0){ //palette transparency
|
||||
- if (info_ptr->num_trans==1){
|
||||
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
|
||||
+ int num_trans = -1;
|
||||
+ png_bytep trans_alpha;
|
||||
+ png_color_16p trans_color;
|
||||
+ if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color)) {
|
||||
+ if (num_trans==1){
|
||||
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE){
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- info.nBkgndIndex = info_ptr->trans_color.index;
|
||||
+ info.nBkgndIndex = trans_color->index;
|
||||
#else
|
||||
- info.nBkgndIndex = info_ptr->trans_values.index;
|
||||
+ info.nBkgndIndex = trans_values->index;
|
||||
#endif
|
||||
} else{
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
|
||||
+ info.nBkgndIndex = trans_color->gray>>nshift;
|
||||
#else
|
||||
- info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
|
||||
+ info.nBkgndIndex = trans_values->gray>>nshift;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
- if (info_ptr->num_trans>1){
|
||||
+ if (num_trans>1){
|
||||
RGBQUAD* pal=GetPalette();
|
||||
if (pal){
|
||||
DWORD ip;
|
||||
- for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
|
||||
+ for (ip=0;ip<min(head.biClrUsed,(unsigned long)num_trans);ip++)
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
|
||||
+ pal[ip].rgbReserved=trans_alpha[ip];
|
||||
#else
|
||||
- pal[ip].rgbReserved=info_ptr->trans[ip];
|
||||
+ pal[ip].rgbReserved=trans[ip];
|
||||
#endif
|
||||
- for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
|
||||
+ for (ip=num_trans;ip<head.biClrUsed;ip++){
|
||||
pal[ip].rgbReserved=255;
|
||||
}
|
||||
info.bAlphaPaletteEnabled=true;
|
||||
}
|
||||
}
|
||||
- }
|
||||
-
|
||||
- if (channels == 3){ //check RGB binary transparency
|
||||
- png_bytep trans;
|
||||
- int num_trans;
|
||||
- png_color_16 *image_background;
|
||||
- if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
|
||||
+ if (channels == 3){ //check RGB binary transparency
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
|
||||
- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
|
||||
- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
|
||||
+ info.nBkgndColor.rgbRed = (BYTE)(trans_color->red>>nshift);
|
||||
+ info.nBkgndColor.rgbGreen = (BYTE)(trans_color->green>>nshift);
|
||||
+ info.nBkgndColor.rgbBlue = (BYTE)(trans_color->blue>>nshift);
|
||||
#else
|
||||
- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
|
||||
- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
|
||||
- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_values.blue>>nshift);
|
||||
+ info.nBkgndColor.rgbRed = (BYTE)(trans_values->red>>nshift);
|
||||
+ info.nBkgndColor.rgbGreen = (BYTE)(trans_values->green>>nshift);
|
||||
+ info.nBkgndColor.rgbBlue = (BYTE)(trans_values->blue>>nshift);
|
||||
#endif
|
||||
info.nBkgndColor.rgbReserved = 0;
|
||||
info.nBkgndIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
int alpha_present = (channels - 1) % 2;
|
||||
if (alpha_present){
|
||||
#if CXIMAGE_SUPPORT_ALPHA // <vho>
|
||||
@@ -202,15 +211,15 @@
|
||||
}
|
||||
|
||||
// <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
|
||||
- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
|
||||
+ if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR){
|
||||
png_set_bgr(png_ptr);
|
||||
}
|
||||
|
||||
// <vho> - handle cancel
|
||||
- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
|
||||
+ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
|
||||
|
||||
// row_bytes is the width x number of channels x (bit-depth / 8)
|
||||
- row_pointers = new BYTE[info_ptr->rowbytes + 8];
|
||||
+ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
|
||||
|
||||
// turn on interlace handling
|
||||
int number_passes = png_set_interlace_handling(png_ptr);
|
||||
@@ -221,8 +230,8 @@
|
||||
SetCodecOption(0);
|
||||
}
|
||||
|
||||
- int chan_offset = info_ptr->bit_depth >> 3;
|
||||
- int pixel_offset = info_ptr->pixel_depth >> 3;
|
||||
+ int chan_offset = png_get_bit_depth(png_ptr, info_ptr) >> 3;
|
||||
+ int pixel_offset = pixel_depth >> 3;
|
||||
|
||||
for (int pass=0; pass < number_passes; pass++) {
|
||||
iter.Upset();
|
||||
@@ -230,7 +239,7 @@
|
||||
do {
|
||||
|
||||
// <vho> - handle cancel
|
||||
- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
|
||||
+ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
|
||||
|
||||
#if CXIMAGE_SUPPORT_ALPHA // <vho>
|
||||
if (AlphaIsValid()) {
|
||||
@@ -241,7 +250,7 @@
|
||||
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 +287,10 @@
|
||||
#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,15 +300,15 @@
|
||||
png_read_row(png_ptr, row_pointers, NULL);
|
||||
|
||||
//shrink 16 bit depth images down to 8 bits
|
||||
- if (info_ptr->bit_depth > 8){
|
||||
+ if (png_get_bit_depth(png_ptr, info_ptr) > 8){
|
||||
for(long ax=0;ax<(head.biWidth*channels);ax++)
|
||||
row_pointers[ax] = row_pointers[ax*chan_offset];
|
||||
}
|
||||
|
||||
//copy the pixels
|
||||
- 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
|
||||
@@ -340,6 +349,16 @@
|
||||
BYTE trans[256]; //for transparency (don't move)
|
||||
png_struct *png_ptr;
|
||||
png_info *info_ptr;
|
||||
+ int channels;
|
||||
+ int bit_depth;
|
||||
+ int color_type;
|
||||
+ png_byte interlace_type = PNG_INTERLACE_NONE;
|
||||
+ png_uint_32 valid = 0;
|
||||
+ png_colorp palette = NULL;
|
||||
+ png_uint_16 num_palette;
|
||||
+ int num_trans;
|
||||
+ png_bytep trans_alpha;
|
||||
+ png_color_16p trans_color;
|
||||
|
||||
cx_try
|
||||
{
|
||||
@@ -362,9 +381,9 @@
|
||||
/* Set error handling. REQUIRED if you aren't supplying your own
|
||||
* error hadnling functions in the png_create_write_struct() call.
|
||||
*/
|
||||
- if (setjmp(png_ptr->jmpbuf)){
|
||||
+ if (setjmp(png_jmpbuf(png_ptr))){
|
||||
/* If we get here, we had a problem reading the file */
|
||||
- if (info_ptr->palette) free(info_ptr->palette);
|
||||
+ if (palette) { free(palette); palette = NULL; }
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
|
||||
cx_throw("Error saving PNG file");
|
||||
}
|
||||
@@ -376,20 +395,11 @@
|
||||
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();
|
||||
- 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);
|
||||
- info_ptr->compression_type = info_ptr->filter_type = 0;
|
||||
- info_ptr->valid = 0;
|
||||
-
|
||||
- switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
|
||||
- case 1:
|
||||
- info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
|
||||
- break;
|
||||
- default:
|
||||
- info_ptr->interlace_type = PNG_INTERLACE_NONE;
|
||||
+ channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
|
||||
+ bit_depth = (BYTE)(GetBpp()/channels);
|
||||
+
|
||||
+ if (GetCodecOption(CXIMAGE_FORMAT_PNG) == 1){
|
||||
+ interlace_type = PNG_INTERLACE_ADAM7;
|
||||
}
|
||||
|
||||
/* set compression level */
|
||||
@@ -399,19 +409,18 @@
|
||||
|
||||
if (GetNumColors()){
|
||||
if (bGrayScale){
|
||||
- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
|
||||
+ color_type = PNG_COLOR_TYPE_GRAY;
|
||||
} else {
|
||||
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
|
||||
+ color_type = PNG_COLOR_TYPE_PALETTE;
|
||||
}
|
||||
} else {
|
||||
- info_ptr->color_type = 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;
|
||||
- info_ptr->pixel_depth += 8;
|
||||
+ color_type |= PNG_COLOR_MASK_ALPHA;
|
||||
+ channels++;
|
||||
+ bit_depth = 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -428,28 +437,27 @@
|
||||
/* 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, GetWidth(), GetHeight(), bit_depth,
|
||||
+ color_type, interlace_type,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
//<DP> simple transparency
|
||||
if (info.nBkgndIndex >= 0){
|
||||
- info_ptr->num_trans = 1;
|
||||
- info_ptr->valid |= PNG_INFO_tRNS;
|
||||
+ num_trans = 1;
|
||||
+ valid |= PNG_INFO_tRNS;
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- info_ptr->trans_alpha = trans;
|
||||
- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
|
||||
- info_ptr->trans_color.red = tc.rgbRed;
|
||||
- info_ptr->trans_color.green = tc.rgbGreen;
|
||||
- info_ptr->trans_color.blue = tc.rgbBlue;
|
||||
- info_ptr->trans_color.gray = info_ptr->trans_color.index;
|
||||
+ trans_alpha = trans;
|
||||
+ trans_color->index = (BYTE)info.nBkgndIndex;
|
||||
+ trans_color->red = tc.rgbRed;
|
||||
+ trans_color->green = tc.rgbGreen;
|
||||
+ trans_color->blue = tc.rgbBlue;
|
||||
+ trans_color->gray = (BYTE)info.nBkgndIndex;
|
||||
#else
|
||||
- info_ptr->trans = trans;
|
||||
- info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
|
||||
- info_ptr->trans_values.red = tc.rgbRed;
|
||||
- info_ptr->trans_values.green = tc.rgbGreen;
|
||||
- info_ptr->trans_values.blue = tc.rgbBlue;
|
||||
- info_ptr->trans_values.gray = info_ptr->trans_values.index;
|
||||
+ trans_values->index = (BYTE)info.nBkgndIndex;
|
||||
+ trans_values->red = tc.rgbRed;
|
||||
+ trans_values->green = tc.rgbGreen;
|
||||
+ trans_values->blue = tc.rgbBlue;
|
||||
+ trans_values->gray = (BYTE)info.nBkgndIndex;
|
||||
#endif
|
||||
|
||||
// the transparency indexes start from 0 for non grayscale palette
|
||||
@@ -460,7 +468,7 @@
|
||||
/* set the palette if there is one */
|
||||
if (GetPalette()){
|
||||
if (!bGrayScale){
|
||||
- info_ptr->valid |= PNG_INFO_PLTE;
|
||||
+ valid |= PNG_INFO_PLTE;
|
||||
}
|
||||
|
||||
int nc = GetClrImportant();
|
||||
@@ -469,20 +477,18 @@
|
||||
if (info.bAlphaPaletteEnabled){
|
||||
for(WORD ip=0; ip<nc;ip++)
|
||||
trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
|
||||
- info_ptr->num_trans = (WORD)nc;
|
||||
- info_ptr->valid |= PNG_INFO_tRNS;
|
||||
+ num_trans = (WORD)nc;
|
||||
+ valid |= PNG_INFO_tRNS;
|
||||
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
|
||||
- info_ptr->trans_alpha = trans;
|
||||
-#else
|
||||
- info_ptr->trans = trans;
|
||||
+ trans_alpha = trans;
|
||||
#endif
|
||||
}
|
||||
|
||||
// copy the palette colors
|
||||
- info_ptr->palette = new png_color[nc];
|
||||
- info_ptr->num_palette = (png_uint_16) nc;
|
||||
+ palette = new png_color[nc];
|
||||
+ num_palette = (png_uint_16) nc;
|
||||
for (int i=0; i<nc; i++)
|
||||
- GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
|
||||
+ GetPaletteColor(i, &palette[i].red, &palette[i].green, &palette[i].blue);
|
||||
}
|
||||
|
||||
#if CXIMAGE_SUPPORT_ALPHA // <vho>
|
||||
@@ -496,8 +502,7 @@
|
||||
} } }
|
||||
#endif // CXIMAGE_SUPPORT_ALPHA // <vho>
|
||||
|
||||
- int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
|
||||
- info_ptr->rowbytes = row_size;
|
||||
+ int row_size = max(info.dwEffWidth, GetWidth()*channels*(bit_depth/8));
|
||||
BYTE *row_pointers = new BYTE[row_size];
|
||||
|
||||
/* write the file information */
|
||||
@@ -515,7 +520,7 @@
|
||||
if (AlphaIsValid()){
|
||||
for (long ax=head.biWidth-1; ax>=0;ax--){
|
||||
c = BlindGetPixelColor(ax,ay);
|
||||
- int px = ax * info_ptr->channels;
|
||||
+ int px = ax * channels;
|
||||
if (!bGrayScale){
|
||||
row_pointers[px++]=c.rgbRed;
|
||||
row_pointers[px++]=c.rgbGreen;
|
||||
@@ -530,7 +535,7 @@
|
||||
#endif //CXIMAGE_SUPPORT_ALPHA // <vho>
|
||||
{
|
||||
iter.GetRow(row_pointers, row_size);
|
||||
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
|
||||
+ if (color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
|
||||
RGBtoBGR(row_pointers, row_size);
|
||||
png_write_row(png_ptr, row_pointers);
|
||||
}
|
||||
@@ -548,9 +553,9 @@
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
|
||||
/* if you malloced the palette, free it here */
|
||||
- if (info_ptr->palette){
|
||||
- delete [] (info_ptr->palette);
|
||||
- info_ptr->palette = NULL;
|
||||
+ if (palette){
|
||||
+ delete [] (palette);
|
||||
+ palette = NULL;
|
||||
}
|
||||
|
||||
/* clean up after the write, and free any memory allocated */
|
||||
--- amsn/utils/TkCximage/src/CxImage/ximapng.h 2012/01/14 15:27:06 12356
|
||||
+++ amsn/utils/TkCximage/src/CxImage/ximapng.h 2012/01/24 21:21:23 12357
|
||||
@@ -64,8 +64,8 @@
|
||||
|
||||
static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
|
||||
{
|
||||
- strncpy((char*)png_ptr->error_ptr,error_msg,255);
|
||||
- longjmp(png_ptr->jmpbuf, 1);
|
||||
+ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
|
||||
+ longjmp(png_jmpbuf(png_ptr), 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
--- amsn/configure.ac 2011/04/08 17:08:27 12314
|
||||
+++ amsn/configure.ac 2011/04/12 00:20:59 12315
|
||||
@@ -489,6 +489,11 @@
|
||||
libv4l2 >= 0.5.0,
|
||||
HAVE_LIBV4L=yes,HAVE_LIBV4L=no)
|
||||
fi
|
||||
+ AC_CHECK_HEADERS(linux/videodev.h,HAVE_LIBV4L=yes,HAVE_LIBV4L=no)
|
||||
+ AC_CHECK_HEADERS(linux/videodev2.h,HAVE_LIBV4L2=yes,HAVE_LIBV4L2=no)
|
||||
+ if test x"$v4l2" = x"yes" ; then
|
||||
+ HAVE_LIBV4L=yes
|
||||
+ fi
|
||||
AC_SUBST(HAVE_LIBV4L)
|
||||
|
||||
AC_ARG_ENABLE([upnp],
|
||||
--- amsn/utils/linux/capture/capture.h 2011/04/08 17:08:27 12314
|
||||
+++ amsn/utils/linux/capture/capture.h 2011/04/12 00:20:59 12315
|
||||
@@ -30,11 +30,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+/*
|
||||
#ifdef HAVE_SYS_VIDEODEV2_H
|
||||
# include <sys/videodev2.h>
|
||||
#else
|
||||
# include <linux/videodev.h>
|
||||
#endif
|
||||
+*/
|
||||
|
||||
#include "grab-ng.h"
|
||||
|
||||
--- amsn/configure 2010/06/17 00:31:07 12053
|
||||
+++ amsn/configure 2011/04/12 00:43:13 12317
|
||||
@@ -597,6 +605,7 @@
|
||||
HAVE_GUPNP
|
||||
GUPNP_LIBS
|
||||
GUPNP_CFLAGS
|
||||
+HAVE_LIBV4L2
|
||||
HAVE_LIBV4L
|
||||
LIBV4L_LIBS
|
||||
LIBV4L_CFLAGS
|
||||
@@ -5688,6 +5697,35 @@
|
||||
HAVE_LIBV4L=yes
|
||||
fi
|
||||
fi
|
||||
+ for ac_header in linux/videodev.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/videodev.h" "ac_cv_header_linux_videodev_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_linux_videodev_h" = xyes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LINUX_VIDEODEV_H 1
|
||||
+_ACEOF
|
||||
+ HAVE_LIBV4L=yes
|
||||
+else
|
||||
+ HAVE_LIBV4L=no
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+ for ac_header in linux/videodev2.h
|
||||
+do :
|
||||
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/videodev2.h" "ac_cv_header_linux_videodev2_h" "$ac_includes_default"
|
||||
+if test "x$ac_cv_header_linux_videodev2_h" = xyes; then :
|
||||
+ cat >>confdefs.h <<_ACEOF
|
||||
+#define HAVE_LINUX_VIDEODEV2_H 1
|
||||
+_ACEOF
|
||||
+ HAVE_LIBV4L2=yes
|
||||
+else
|
||||
+ HAVE_LIBV4L2=no
|
||||
+fi
|
||||
+
|
||||
+done
|
||||
+
|
||||
+
|
||||
|
||||
|
||||
# Check whether --enable-upnp was given.
|
||||
@@ -7058,6 +7124,7 @@
|
||||
STATIC : $STATIC
|
||||
FARSIGHT : $HAVE_FARSIGHT
|
||||
LIBV4L : $HAVE_LIBV4L
|
||||
+ LIBV4L2 : $HAVE_LIBV4L2
|
||||
GUPNP-IGD : $HAVE_GUPNP
|
||||
|
||||
EOF
|
||||
22
amsn-0.98.9-chrpath.patch
Normal file
22
amsn-0.98.9-chrpath.patch
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--- amsn/utils/linux/capture/libng/plugins/Rules.mk (revision 12409)
|
||||
+++ amsn/utils/linux/capture/libng/plugins/Rules.mk (working copy)
|
||||
@@ -11,7 +11,7 @@
|
||||
rm -f $(TARGETS-plugins) $(capture_dir)/libng/plugins/*.o
|
||||
|
||||
$(TARGETS-plugins): CFLAGS+=$(V4L_CFLAGS) -I$(capture_dir) -I$(capture_dir)/libng -I$(capture_dir)/structs
|
||||
-$(TARGETS-plugins): LDFLAGS+=$(foreach rp,$(RPATH),"-Wl,-rpath=$(rp)/$(capture_dir)/libng")
|
||||
+$(TARGETS-plugins): LDFLAGS+=-Wl,-rpath=$(libdir)/amsn/utils/capture/libng
|
||||
$(TARGETS-plugins): MORE_LIBS=-L$(capture_dir)/libng -lng
|
||||
|
||||
$(TARGETS-plugins): | $(capture_dir)/libng/libng.so
|
||||
--- amsn/utils/linux/capture/Rules.mk (revision 12409)
|
||||
+++ amsn/utils/linux/capture/Rules.mk (working copy)
|
||||
@@ -4,7 +4,7 @@
|
||||
$(OBJS-capture): CFLAGS+=-I$(capture_dir) -I$(capture_dir)/libng
|
||||
|
||||
$(TARGETS-capture): MORE_LIBS=-L$(capture_dir)/libng -lng
|
||||
-$(TARGETS-capture): LDFLAGS+=$(foreach rp,$(RPATH),"-Wl,-rpath=$(rp)/$(capture_dir)/libng")
|
||||
+$(TARGETS-capture): LDFLAGS+=-Wl,-rpath=$(libdir)/amsn/utils/capture/libng
|
||||
|
||||
$(TARGETS-capture): $(OBJS-capture) | $(capture_dir)/libng/libng.so
|
||||
@$(echo_link_so)
|
||||
58
amsn.spec
58
amsn.spec
|
|
@ -2,8 +2,8 @@
|
|||
%{!?tcl_sitearch: %define tcl_sitearch %{_libdir}/tcl%{tcl_version}}
|
||||
|
||||
Name: amsn
|
||||
Version: 0.98.4
|
||||
Release: 8%{?dist}
|
||||
Version: 0.98.9
|
||||
Release: 4%{?dist}
|
||||
Summary: MSN Messenger clone for Linux, Mac and Windows
|
||||
|
||||
Group: Applications/Internet
|
||||
|
|
@ -11,19 +11,24 @@ License: GPLv2
|
|||
URL: http://www.amsn-project.net/
|
||||
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}-src.tar.bz2
|
||||
Patch0: amsn-0.98.1-usesnack.patch
|
||||
Patch1: amsn-0.98.4-useV4L2.patch
|
||||
Patch2: amsn-0.98.4-libpng15.patch
|
||||
Patch1: amsn-0.98.9-chrpath.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: desktop-file-utils, tk-devel, which, libpng-devel, libjpeg-devel
|
||||
%if 0%{?fedora} >= 17
|
||||
BuildRequires: farstream-devel
|
||||
%else
|
||||
BuildRequires: farsight2-devel
|
||||
%endif
|
||||
BuildRequires: gupnp-igd-devel
|
||||
BuildRequires: libv4l-devel
|
||||
BuildRequires: tcl(abi) = %{tcl_version}
|
||||
BuildRequires: autoconf, automake, libtool
|
||||
Requires: tcl(abi) = %{tcl_version}
|
||||
Requires: tcl-snack
|
||||
Requires: tcltls, tclsoap, bwidget, tkdnd, xdg-utils
|
||||
Requires: tcltls, bwidget, tkdnd, xdg-utils
|
||||
Requires: tktray
|
||||
Requires: tcllib
|
||||
|
||||
%description
|
||||
This is an MSN Messenger clone for Unix, Windows, and Macintosh.
|
||||
|
|
@ -44,7 +49,8 @@ snapshots with your webcam to use as your display picture.
|
|||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
autoreconf -i -f -v
|
||||
|
||||
rm -r utils/BWidget-1.9.0
|
||||
rm -r skins/default/winicons
|
||||
|
|
@ -52,8 +58,8 @@ rm -r plugins/music/MusicWin
|
|||
rm plugins/amsnplus/snapshot
|
||||
|
||||
# for webcam to work these paths need to be added because we move libs around
|
||||
%{__sed} -i 's#\.\./libng/plugins#%{tcl_sitearch}/capture/libng/plugins#' utils/linux/capture/libng/grab-ng.c
|
||||
%{__sed} -i 's#\.\./libng/contrib-plugins#%{tcl_sitearch}/capture/libng/contrib-plugins#' utils/linux/capture/libng/grab-ng.c
|
||||
%{__sed} -i 's#\.\./libng/plugins#%{_libdir}/%{name}/utils/capture/libng/plugins#' utils/linux/capture/libng/grab-ng.c
|
||||
%{__sed} -i 's#\.\./libng/contrib-plugins#%{_libdir}/%{name}/utils/capture/libng/contrib-plugins#' utils/linux/capture/libng/grab-ng.c
|
||||
|
||||
%{__sed} -i 's# utils/BWidget-1.9.0##' Makefile.in
|
||||
%{__sed} -i 's#soundcommand "play \\$sound"#soundcommand "aplay -q \\$sound"#' config.tcl
|
||||
|
|
@ -81,15 +87,8 @@ rm -r ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/docs
|
|||
rm -r ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/{AGREEMENT,FAQ,GNUGPL,INSTALL,remote.help,TODO}
|
||||
rm -r ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/lang/{*.*,LANG-HOWTO,sortlang}
|
||||
|
||||
mkdir -p ${RPM_BUILD_ROOT}/%{tcl_sitearch}
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/linux/* ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/TkCximage ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/webcamsn ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/tcl_siren ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/tclISF ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/gupnp ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/farsight ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/utils/asyncresolver ${RPM_BUILD_ROOT}/%{tcl_sitearch}/
|
||||
mv ${RPM_BUILD_ROOT}/%{_libdir}/%{name}/utils/linux/* ${RPM_BUILD_ROOT}/%{_libdir}/%{name}/utils/
|
||||
rm -r ${RPM_BUILD_ROOT}/%{_libdir}/%{name}/utils/linux/
|
||||
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/icons/
|
||||
mv ${RPM_BUILD_ROOT}%{_datadir}/amsn/desktop-icons/ ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/
|
||||
|
|
@ -114,9 +113,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||
%{_bindir}/amsn-remote
|
||||
%{_bindir}/amsn-remote-CLI
|
||||
%{_datadir}/%{name}/
|
||||
%{_libdir}/%{name}/
|
||||
%{_datadir}/applications/fedora-amsn.desktop
|
||||
%{_datadir}/icons/hicolor/*/*/amsn.png
|
||||
%{tcl_sitearch}/*
|
||||
%exclude %{_datadir}/%{name}/plugins/*
|
||||
|
||||
%files plugins
|
||||
|
|
@ -137,6 +136,29 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon Jul 16 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.9-4
|
||||
- *sigh*, didn't mean to remove those lines
|
||||
|
||||
* Mon Jul 16 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.9-3
|
||||
- How hard can it be to get this right? Finally did it.
|
||||
|
||||
* Tue Jul 03 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.9-2
|
||||
- We do actually move libs around, so add proper fix for that
|
||||
|
||||
* Tue Jul 03 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.9-1
|
||||
- We don't actually move libs around anymore, so drop fix for that
|
||||
|
||||
* Mon Jun 25 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.9-0
|
||||
- Update to new version
|
||||
- require tcllib, it isn't pulled in by other dependencies anymore
|
||||
- drop upstreamed patches
|
||||
|
||||
* Fri Mar 9 2012 Tom Callaway <spot@fedoraproject.org> 0.98.4-10
|
||||
- support farstream instead of deprecated farsight2
|
||||
|
||||
* Fri Feb 09 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.4-9
|
||||
- remove old dependency on tclsoap, upstream doesn't need it for a long time already
|
||||
|
||||
* Fri Jan 27 2012 Sander Hoentjen <sander@hoentjen.eu> 0.98.4-8
|
||||
- Fix compile against new libpng (backport http://amsn.svn.sourceforge.net/viewvc/amsn?view=revision&revision=12357)
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
96fd20e8709ced4443432d125a5e0a5a amsn-0.98.4-src.tar.bz2
|
||||
13885ccc9972b2722e33552601c5b2b4 amsn-0.98.9-src.tar.bz2
|
||||
|
|
|
|||
Reference in a new issue