Mon Aug 1 01:16:50 2011 UTC ()
Fix build with png-1.5, fully now. Also add various REPLACE_INTERPRETER
and add a dependency on Python for the two installed Python scripts. No
version bump since this hasn't been buildable in a long time.


(dholland)
diff -r1.20 -r1.21 pkgsrc/chat/amsn/Makefile
diff -r1.8 -r1.9 pkgsrc/chat/amsn/distinfo
diff -r1.2 -r1.3 pkgsrc/chat/amsn/patches/patch-utils_TkCximage_src_CxImage_ximapng.cpp

cvs diff -r1.20 -r1.21 pkgsrc/chat/amsn/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/chat/amsn/Attic/Makefile 2011/04/03 22:10:35 1.20
+++ pkgsrc/chat/amsn/Attic/Makefile 2011/08/01 01:16:50 1.21
@@ -1,55 +1,65 @@ @@ -1,55 +1,65 @@
1# $NetBSD: Makefile,v 1.20 2011/04/03 22:10:35 zafer Exp $ 1# $NetBSD: Makefile,v 1.21 2011/08/01 01:16:50 dholland Exp $
2# 2#
3 3
4DISTNAME= amsn-0.98.3 4DISTNAME= amsn-0.98.3
5PKGREVISION= 3 5PKGREVISION= 3
6CATEGORIES= chat 6CATEGORIES= chat
7MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=amsn/} 7MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=amsn/}
8DISTFILES= ${DISTNAME}-src.tar.bz2 8DISTFILES= ${DISTNAME}-src.tar.bz2
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= http://www.amsn-project.net/ 11HOMEPAGE= http://www.amsn-project.net/
12COMMENT= Alvaro\'s MSN messenger client 12COMMENT= Alvaro\'s MSN messenger client
13LICENSE= gnu-gpl-v2 13LICENSE= gnu-gpl-v2
14 14
15PKG_DESTDIR_SUPPORT= user-destdir 15PKG_DESTDIR_SUPPORT= user-destdir
16GNU_CONFIGURE= yes 16GNU_CONFIGURE= yes
17CONFIGURE_ARGS+= --with-tcl=${BUILDLINK_PREFIX.tcl}/lib 17CONFIGURE_ARGS+= --with-tcl=${BUILDLINK_PREFIX.tcl}/lib
18USE_LANGUAGES= c c++ 18USE_LANGUAGES= c c++
19AUTO_MKDIRS= yes 19AUTO_MKDIRS= yes
20 20
21REPLACE_INTERPRETER+= WISH 21REPLACE_INTERPRETER+= WISH
22REPLACE.WISH.old= .*wish 22REPLACE.WISH.old= .*wish
23REPLACE.WISH.new= ${PREFIX}/bin/wish 23REPLACE.WISH.new= ${PREFIX}/bin/wish
24REPLACE_FILES.WISH= amsn-remote 24REPLACE_FILES.WISH= amsn-remote
 25REPLACE_FILES.WISH+= skins/Dark\ Matter\ 4.0/pixmapscroll/test.tcl
 26REPLACE_FILES.WISH+= skins/Oxygen/pixmapscroll/test.tcl
 27REPLACE_FILES.WISH+= utils/linux/capture/test.tcl
 28REPLACE_FILES.WISH+= utils/pixmapbutton/test.tcl
 29REPLACE_FILES.WISH+= utils/pixmapprogbar/test.tcl
 30REPLACE_FILES.WISH+= utils/pixmapscroll/test.tcl
 31REPLACE_FILES.WISH+= utils/voipcontrols/test.tcl
25 32
26REPLACE_INTERPRETER+= TCLSH 33REPLACE_INTERPRETER+= TCLSH
27REPLACE.TCLSH.old= .*tclsh 34REPLACE.TCLSH.old= .*tclsh
28REPLACE.TCLSH.new= ${PREFIX}/bin/tclsh 35REPLACE.TCLSH.new= ${PREFIX}/bin/tclsh
29REPLACE_FILES.TCLSH= amsn-remote-CLI lang/convert.tcl 36REPLACE_FILES.TCLSH= amsn-remote-CLI lang/convert.tcl
30 37
31REPLACE_PERL= utils/amsnctl.pl lang/complete.pl 38REPLACE_PERL= utils/amsnctl.pl lang/complete.pl
32REPLACE_PERL+= plugins/music/infogmusicbrowser 39REPLACE_PERL+= plugins/music/infogmusicbrowser
33REPLACE_BASH= utils/update-amsn.sh 40REPLACE_BASH= utils/update-amsn.sh
34REPLACE_BASH+= plugins/music/infoamarok2 41REPLACE_BASH+= plugins/music/infoamarok2
35REPLACE_BASH+= plugins/music/infoexaile 42REPLACE_BASH+= plugins/music/infoexaile
36REPLACE_BASH+= plugins/music/infojuk2 43REPLACE_BASH+= plugins/music/infojuk2
37REPLACE_BASH+= plugins/music/infolastfm 44REPLACE_BASH+= plugins/music/infolastfm
38REPLACE_BASH+= plugins/music/infomoc 45REPLACE_BASH+= plugins/music/infomoc
39REPLACE_BASH+= plugins/music/infompris 46REPLACE_BASH+= plugins/music/infompris
40REPLACE_BASH+= plugins/music/inforhythmbox 47REPLACE_BASH+= plugins/music/inforhythmbox
41REPLACE_BASH+= plugins/music/infospotify 48REPLACE_BASH+= plugins/music/infospotify
42REPLACE_BASH+= plugins/music/infovlc 49REPLACE_BASH+= plugins/music/infovlc
 50REPLACE_PYTHON+= plugins/music/infosongbird
 51REPLACE_PYTHON+= lang/missing.py
43USE_TOOLS+= perl:run bash:run 52USE_TOOLS+= perl:run bash:run
44 53
45USE_TOOLS+= gmake 54USE_TOOLS+= gmake
46 55
47CHECK_PORTABILITY_SKIP= utils/macosx/finishbuild.sh 56CHECK_PORTABILITY_SKIP= utils/macosx/finishbuild.sh
48 57
 58.include "../../lang/python/application.mk"
49.include "../../security/tcl-tls/buildlink3.mk" 59.include "../../security/tcl-tls/buildlink3.mk"
50.include "../../lang/tcl/buildlink3.mk" 60.include "../../lang/tcl/buildlink3.mk"
51.include "../../x11/tk/buildlink3.mk" 61.include "../../x11/tk/buildlink3.mk"
52.include "../../graphics/png/buildlink3.mk" 62.include "../../graphics/png/buildlink3.mk"
53.include "../../mk/jpeg.buildlink3.mk" 63.include "../../mk/jpeg.buildlink3.mk"
54.include "../../sysutils/desktop-file-utils/desktopdb.mk" 64.include "../../sysutils/desktop-file-utils/desktopdb.mk"
55.include "../../mk/bsd.pkg.mk" 65.include "../../mk/bsd.pkg.mk"

cvs diff -r1.8 -r1.9 pkgsrc/chat/amsn/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/chat/amsn/Attic/distinfo 2011/08/01 00:43:58 1.8
+++ pkgsrc/chat/amsn/Attic/distinfo 2011/08/01 01:16:50 1.9
@@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
1$NetBSD: distinfo,v 1.8 2011/08/01 00:43:58 dholland Exp $ 1$NetBSD: distinfo,v 1.9 2011/08/01 01:16:50 dholland Exp $
2 2
3SHA1 (amsn-0.98.3-src.tar.bz2) = aa8383a11ce66352aceee27f9c291c1410b3403d 3SHA1 (amsn-0.98.3-src.tar.bz2) = aa8383a11ce66352aceee27f9c291c1410b3403d
4RMD160 (amsn-0.98.3-src.tar.bz2) = 20f707062da4a5ab1eb6beec49d01dfd2ba90a99 4RMD160 (amsn-0.98.3-src.tar.bz2) = 20f707062da4a5ab1eb6beec49d01dfd2ba90a99
5Size (amsn-0.98.3-src.tar.bz2) = 13275477 bytes 5Size (amsn-0.98.3-src.tar.bz2) = 13275477 bytes
6SHA1 (patch-configure) = ddbd6a9616683c44202a551d734b2c9b10b2e05b 6SHA1 (patch-configure) = ddbd6a9616683c44202a551d734b2c9b10b2e05b
7SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.cpp) = 2dfad18af89fb7f5ec4e316bfc35f6ed40377e10 7SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.cpp) = 823904f7b17aff6034339e7873135edb7362b489
8SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.h) = 1d7a1cc0acd397629a0e6b1f83f9fdf943fb6d8a 8SHA1 (patch-utils_TkCximage_src_CxImage_ximapng.h) = 1d7a1cc0acd397629a0e6b1f83f9fdf943fb6d8a

cvs diff -r1.2 -r1.3 pkgsrc/chat/amsn/patches/Attic/patch-utils_TkCximage_src_CxImage_ximapng.cpp (expand / switch to unified diff)

--- pkgsrc/chat/amsn/patches/Attic/patch-utils_TkCximage_src_CxImage_ximapng.cpp 2011/08/01 00:43:58 1.2
+++ pkgsrc/chat/amsn/patches/Attic/patch-utils_TkCximage_src_CxImage_ximapng.cpp 2011/08/01 01:16:50 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: patch-utils_TkCximage_src_CxImage_ximapng.cpp,v 1.2 2011/08/01 00:43:58 dholland Exp $ 1$NetBSD: patch-utils_TkCximage_src_CxImage_ximapng.cpp,v 1.3 2011/08/01 01:16:50 dholland Exp $
2 2
3Fix build with png-1.5. 3Fix build with png-1.5.
4 4
5--- utils/TkCximage/src/CxImage/ximapng.cpp.orig 2010-01-29 09:09:27.000000000 +0000 5--- utils/TkCximage/src/CxImage/ximapng.cpp.orig 2010-01-29 09:09:27.000000000 +0000
6+++ utils/TkCximage/src/CxImage/ximapng.cpp 6+++ utils/TkCximage/src/CxImage/ximapng.cpp
7@@ -15,7 +15,7 @@ 7@@ -15,7 +15,7 @@
8 void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message) 8 void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
9 { 9 {
10 strcpy(info.szLastError,message); 10 strcpy(info.szLastError,message);
11- longjmp(png_ptr->jmpbuf, 1); 11- longjmp(png_ptr->jmpbuf, 1);
12+ longjmp(png_jmpbuf(png_ptr), 1); 12+ longjmp(png_jmpbuf(png_ptr), 1);
13 } 13 }
14 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
@@ -258,36 +258,38 @@ Fix build with png-1.5. @@ -258,36 +258,38 @@ Fix build with png-1.5.
258 //go on 258 //go on
259@@ -340,6 +341,11 @@ bool CxImagePNG::Encode(CxFile *hFile) 259@@ -340,6 +341,11 @@ bool CxImagePNG::Encode(CxFile *hFile)
260 BYTE trans[256]; //for transparency (don't move) 260 BYTE trans[256]; //for transparency (don't move)
261 png_struct *png_ptr; 261 png_struct *png_ptr;
262 png_info *info_ptr; 262 png_info *info_ptr;
263+ png_uint_32 width, height; 263+ png_uint_32 width, height;
264+ png_byte bit_depth; 264+ png_byte bit_depth;
265+ png_byte color_type; 265+ png_byte color_type;
266+ png_byte interlace_type; 266+ png_byte interlace_type;
267+ BYTE channels; 267+ BYTE channels;
268  268
269 cx_try 269 cx_try
270 { 270 {
271@@ -362,7 +368,7 @@ bool CxImagePNG::Encode(CxFile *hFile) 271@@ -362,9 +368,8 @@ bool CxImagePNG::Encode(CxFile *hFile)
272 /* Set error handling. REQUIRED if you aren't supplying your own 272 /* Set error handling. REQUIRED if you aren't supplying your own
273 * error hadnling functions in the png_create_write_struct() call. 273 * error hadnling functions in the png_create_write_struct() call.
274 */ 274 */
275- if (setjmp(png_ptr->jmpbuf)){ 275- if (setjmp(png_ptr->jmpbuf)){
276+ if (setjmp(png_jmpbuf(png_ptr))){ 276+ if (setjmp(png_jmpbuf(png_ptr))){
277 /* If we get here, we had a problem reading the file */ 277 /* If we get here, we had a problem reading the file */
278 if (info_ptr->palette) free(info_ptr->palette); 278- if (info_ptr->palette) free(info_ptr->palette);
279 png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr); 279 png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
280@@ -376,20 +382,18 @@ bool CxImagePNG::Encode(CxFile *hFile) 280 cx_throw("Error saving PNG file");
 281 }
 282@@ -376,20 +381,18 @@ bool CxImagePNG::Encode(CxFile *hFile)
281 png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data); 283 png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
282  284
283 /* set the file information here */ 285 /* set the file information here */
284- info_ptr->width = GetWidth(); 286- info_ptr->width = GetWidth();
285- info_ptr->height = GetHeight(); 287- info_ptr->height = GetHeight();
286- info_ptr->pixel_depth = (BYTE)GetBpp(); 288- info_ptr->pixel_depth = (BYTE)GetBpp();
287- info_ptr->channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1; 289- info_ptr->channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
288- info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels); 290- info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
289- info_ptr->compression_type = info_ptr->filter_type = 0; 291- info_ptr->compression_type = info_ptr->filter_type = 0;
290- info_ptr->valid = 0; 292- info_ptr->valid = 0;
291+ width = GetWidth(); 293+ width = GetWidth();
292+ height = GetHeight(); 294+ height = GetHeight();
293+ //pixel_depth = (BYTE)GetBpp(); 295+ //pixel_depth = (BYTE)GetBpp();
@@ -295,95 +297,166 @@ Fix build with png-1.5. @@ -295,95 +297,166 @@ Fix build with png-1.5.
295+ bit_depth = (BYTE)(GetBpp()/channels); 297+ bit_depth = (BYTE)(GetBpp()/channels);
296  298
297 switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){ 299 switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
298 case 1: 300 case 1:
299- info_ptr->interlace_type = PNG_INTERLACE_ADAM7; 301- info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
300+ interlace_type = PNG_INTERLACE_ADAM7; 302+ interlace_type = PNG_INTERLACE_ADAM7;
301 break; 303 break;
302 default: 304 default:
303- info_ptr->interlace_type = PNG_INTERLACE_NONE; 305- info_ptr->interlace_type = PNG_INTERLACE_NONE;
304+ interlace_type = PNG_INTERLACE_NONE; 306+ interlace_type = PNG_INTERLACE_NONE;
305 } 307 }
306  308
307 /* set compression level */ 309 /* set compression level */
308@@ -399,19 +403,19 @@ bool CxImagePNG::Encode(CxFile *hFile) 310@@ -399,19 +402,19 @@ bool CxImagePNG::Encode(CxFile *hFile)
309  311
310 if (GetNumColors()){ 312 if (GetNumColors()){
311 if (bGrayScale){ 313 if (bGrayScale){
312- info_ptr->color_type = PNG_COLOR_TYPE_GRAY; 314- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
313+ color_type = PNG_COLOR_TYPE_GRAY; 315+ color_type = PNG_COLOR_TYPE_GRAY;
314 } else { 316 } else {
315- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; 317- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
316+ color_type = PNG_COLOR_TYPE_PALETTE; 318+ color_type = PNG_COLOR_TYPE_PALETTE;
317 } 319 }
318 } else { 320 } else {
319- info_ptr->color_type = PNG_COLOR_TYPE_RGB; 321- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
320+ color_type = PNG_COLOR_TYPE_RGB; 322+ color_type = PNG_COLOR_TYPE_RGB;
321 } 323 }
322 #if CXIMAGE_SUPPORT_ALPHA 324 #if CXIMAGE_SUPPORT_ALPHA
323 if (AlphaIsValid()){ 325 if (AlphaIsValid()){
324- info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; 326- info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
325- info_ptr->channels++; 327- info_ptr->channels++;
326- info_ptr->bit_depth = 8; 328- info_ptr->bit_depth = 8;
327- info_ptr->pixel_depth += 8; 329- info_ptr->pixel_depth += 8;
328+ color_type |= PNG_COLOR_MASK_ALPHA; 330+ color_type |= PNG_COLOR_MASK_ALPHA;
329+ channels++; 331+ channels++;
330+ bit_depth = 8; 332+ bit_depth = 8;
331+ //pixel_depth += 8; 333+ //pixel_depth += 8;
332 } 334 }
333 #endif 335 #endif
334  336
335@@ -428,8 +432,8 @@ bool CxImagePNG::Encode(CxFile *hFile) 337@@ -428,29 +431,21 @@ bool CxImagePNG::Encode(CxFile *hFile)
336 /* set metrics */ 338 /* set metrics */
337 png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER); 339 png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
338  340
339- png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth, 341- png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
340- info_ptr->color_type, info_ptr->interlace_type, 342- info_ptr->color_type, info_ptr->interlace_type,
341+ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, 343+ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
342+ color_type, interlace_type, 344+ color_type, interlace_type,
343 PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); 345 PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
344  346
345 //<DP> simple transparency 347 //<DP> simple transparency
346@@ -469,13 +473,7 @@ bool CxImagePNG::Encode(CxFile *hFile) 348 if (info.nBkgndIndex >= 0){
 349- info_ptr->num_trans = 1;
 350- info_ptr->valid |= PNG_INFO_tRNS;
 351-#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 352- info_ptr->trans_alpha = trans;
 353- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
 354- info_ptr->trans_color.red = tc.rgbRed;
 355- info_ptr->trans_color.green = tc.rgbGreen;
 356- info_ptr->trans_color.blue = tc.rgbBlue;
 357- info_ptr->trans_color.gray = info_ptr->trans_color.index;
 358-#else
 359- info_ptr->trans = trans;
 360- info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
 361- info_ptr->trans_values.red = tc.rgbRed;
 362- info_ptr->trans_values.green = tc.rgbGreen;
 363- info_ptr->trans_values.blue = tc.rgbBlue;
 364- info_ptr->trans_values.gray = info_ptr->trans_values.index;
 365-#endif
 366+ png_color_16 trans_color;
 367+
 368+ trans_color.index = (BYTE)info.nBkgndIndex;
 369+ trans_color.red = tc.rgbRed;
 370+ trans_color.green = tc.rgbGreen;
 371+ trans_color.blue = tc.rgbBlue;
 372+ trans_color.gray = (BYTE)info.nBkgndIndex;
 373+
 374+ png_set_tRNS(png_ptr, info_ptr, trans, 1, &trans_color);
 375
 376 // the transparency indexes start from 0 for non grayscale palette
 377 if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
 378@@ -459,30 +454,27 @@ bool CxImagePNG::Encode(CxFile *hFile)
 379
 380 /* set the palette if there is one */
 381 if (GetPalette()){
 382- if (!bGrayScale){
 383- info_ptr->valid |= PNG_INFO_PLTE;
 384- }
 385-
 386 int nc = GetClrImportant();
 387 if (nc==0) nc = GetNumColors();
 388
347 if (info.bAlphaPaletteEnabled){ 389 if (info.bAlphaPaletteEnabled){
348 for(WORD ip=0; ip<nc;ip++) 390 for(WORD ip=0; ip<nc;ip++)
349 trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved; 391 trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
350- info_ptr->num_trans = (WORD)nc; 392- info_ptr->num_trans = (WORD)nc;
351- info_ptr->valid |= PNG_INFO_tRNS; 393- info_ptr->valid |= PNG_INFO_tRNS;
352-#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4 394-#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
353- info_ptr->trans_alpha = trans; 395- info_ptr->trans_alpha = trans;
354-#else 396-#else
355- info_ptr->trans = trans; 397- info_ptr->trans = trans;
356-#endif 398-#endif
357+ png_set_tRNS(png_ptr, info_ptr, trans, (WORD)nc, NULL); 399+ png_set_tRNS(png_ptr, info_ptr, trans, (WORD)nc, NULL);
358 } 400 }
359  401
360 // copy the palette colors 402 // copy the palette colors
361@@ -496,8 +494,8 @@ bool CxImagePNG::Encode(CxFile *hFile) 403- info_ptr->palette = new png_color[nc];
 404- info_ptr->num_palette = (png_uint_16) nc;
 405- for (int i=0; i<nc; i++)
 406- GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
 407+ if (!bGrayScale) {
 408+ png_color *palette;
 409+
 410+ palette = (png_color *)png_malloc(png_ptr, nc*sizeof(palette[0]));
 411+ for (int i=0; i<nc; i++)
 412+ GetPaletteColor(i, &palette[i].red, &palette[i].green, &palette[i].blue);
 413+ png_set_PLTE(png_ptr, info_ptr, palette, nc);
 414+ png_data_freer(png_ptr, info_ptr,
 415+ PNG_DESTROY_WILL_FREE_DATA,
 416+ PNG_FREE_PLTE);
 417+ }
 418 }
 419
 420 #if CXIMAGE_SUPPORT_ALPHA // <vho>
 421@@ -496,8 +488,8 @@ bool CxImagePNG::Encode(CxFile *hFile)
362 } } } 422 } } }
363 #endif // CXIMAGE_SUPPORT_ALPHA // <vho> 423 #endif // CXIMAGE_SUPPORT_ALPHA // <vho>
364  424
365- int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8)); 425- int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
366- info_ptr->rowbytes = row_size; 426- info_ptr->rowbytes = row_size;
367+ int row_size = max(info.dwEffWidth, png_get_rowbytes(png_ptr, info_ptr)); 427+ int row_size = max(info.dwEffWidth, png_get_rowbytes(png_ptr, info_ptr));
368+ //info_ptr->rowbytes = row_size; 428+ //info_ptr->rowbytes = row_size;
369 BYTE *row_pointers = new BYTE[row_size]; 429 BYTE *row_pointers = new BYTE[row_size];
370  430
371 /* write the file information */ 431 /* write the file information */
372@@ -515,7 +513,7 @@ bool CxImagePNG::Encode(CxFile *hFile) 432@@ -515,7 +507,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
373 if (AlphaIsValid()){ 433 if (AlphaIsValid()){
374 for (long ax=head.biWidth-1; ax>=0;ax--){ 434 for (long ax=head.biWidth-1; ax>=0;ax--){
375 c = BlindGetPixelColor(ax,ay); 435 c = BlindGetPixelColor(ax,ay);
376- int px = ax * info_ptr->channels; 436- int px = ax * info_ptr->channels;
377+ int px = ax * png_get_channels(png_ptr, info_ptr); 437+ int px = ax * png_get_channels(png_ptr, info_ptr);
378 if (!bGrayScale){ 438 if (!bGrayScale){
379 row_pointers[px++]=c.rgbRed; 439 row_pointers[px++]=c.rgbRed;
380 row_pointers[px++]=c.rgbGreen; 440 row_pointers[px++]=c.rgbGreen;
381@@ -530,7 +528,7 @@ bool CxImagePNG::Encode(CxFile *hFile) 441@@ -530,7 +522,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
382 #endif //CXIMAGE_SUPPORT_ALPHA // <vho> 442 #endif //CXIMAGE_SUPPORT_ALPHA // <vho>
383 { 443 {
384 iter.GetRow(row_pointers, row_size); 444 iter.GetRow(row_pointers, row_size);
385- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP 445- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
386+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB) //HACK BY OP 446+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB) //HACK BY OP
387 RGBtoBGR(row_pointers, row_size); 447 RGBtoBGR(row_pointers, row_size);
388 png_write_row(png_ptr, row_pointers); 448 png_write_row(png_ptr, row_pointers);
389 } 449 }
 450@@ -547,12 +539,6 @@ bool CxImagePNG::Encode(CxFile *hFile)
 451 /* It is REQUIRED to call this to finish writing the rest of the file */
 452 png_write_end(png_ptr, info_ptr);
 453
 454- /* if you malloced the palette, free it here */
 455- if (info_ptr->palette){
 456- delete [] (info_ptr->palette);
 457- info_ptr->palette = NULL;
 458- }
 459-
 460 /* clean up after the write, and free any memory allocated */
 461 png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
 462