source: trunk/dports/print/transfig/files/patch-libpng-1.5.diff @ 97304

Last change on this file since 97304 was 97304, checked in by ryandesign@…, 7 years ago

transfig: fix build with libpng 1.5, using patch from Gentoo from Alexis Ballier

File size: 1.2 KB
  • fig2dev/dev/readpng.c

    old new read_png(file,filetype,pic,llx,lly) 
    6262    }
    6363
    6464    /* set long jump here */
    65     if (setjmp(png_ptr->jmpbuf)) {
     65    if (setjmp(png_jmpbuf(png_ptr))) {
    6666        /* if we get here there was a problem reading the file */
    6767        png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
    6868        return 0;
    read_png(file,filetype,pic,llx,lly) 
    7878    png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type,
    7979        &interlace_type, &compression_type, &filter_type);
    8080
    81     if (info_ptr->valid & PNG_INFO_gAMA)
    82         png_set_gamma(png_ptr, 2.2, info_ptr->gamma);
    83     else
    84         png_set_gamma(png_ptr, 2.2, 0.45);
     81    png_fixed_point gamma = 0.45;
     82    png_get_gAMA_fixed(png_ptr,info_ptr,&gamma);
     83    png_set_gamma(png_ptr, 2.2, gamma);
    8584
    86     if (info_ptr->valid & PNG_INFO_bKGD)
     85    if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) {
    8786        /* set the background to the one supplied */
    88         png_set_background(png_ptr, &info_ptr->background,
     87        png_color_16p background;
     88        png_get_bKGD(png_ptr,info_ptr,&background);
     89        png_set_background(png_ptr, background,
    8990                PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
     91    }
    9092    else {
    9193        /* blend the canvas background using the alpha channel */
    9294        if (bgspec) {
Note: See TracBrowser for help on using the repository browser.