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

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

transfig:

  • fix libpng changes to be more in-line with the intent of the original code (hopefully);
  • add patch to make c code compile more cleanly and be more C99 compliant (works with clang now).
File size: 1.3 KB
  • fig2dev/dev/readpng.c

    old new  
    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;
     
    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);
     81    double gamma = 0.45;
     82    if (png_get_gAMA(png_ptr,info_ptr,&gamma))
     83      png_set_gamma(png_ptr, 2.2, gamma);
    8384    else
    84         png_set_gamma(png_ptr, 2.2, 0.45);
     85      png_set_gamma(png_ptr, 2.2, 0.45);
    8586
    86     if (info_ptr->valid & PNG_INFO_bKGD)
     87    if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) {
    8788        /* set the background to the one supplied */
    88         png_set_background(png_ptr, &info_ptr->background,
     89        png_color_16p background;
     90        png_get_bKGD(png_ptr,info_ptr,&background);
     91        png_set_background(png_ptr, background,
    8992                PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
     93    }
    9094    else {
    9195        /* blend the canvas background using the alpha channel */
    9296        if (bgspec) {
Note: See TracBrowser for help on using the repository browser.