Enchance -libpng15.patch by _AxS_ from Freenode with some bits also from NetBSD....
authorSamuli Suominen <ssuominen@gentoo.org>
Thu, 15 Sep 2011 22:05:48 +0000 (22:05 +0000)
committerSamuli Suominen <ssuominen@gentoo.org>
Thu, 15 Sep 2011 22:05:48 +0000 (22:05 +0000)
Package-Manager: portage-2.2.0_alpha55/cvs/Linux x86_64

media-gfx/xv/ChangeLog
media-gfx/xv/Manifest
media-gfx/xv/files/xv-3.10a-libpng15.patch
media-gfx/xv/xv-3.10a-r16.ebuild

index e3eb935d031e1aafaeb9de4075f72beb813ab85e..c8fc38c1457e9d8bfbfcabe36903bb4c9e47121c 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for media-gfx/xv
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/ChangeLog,v 1.104 2011/08/12 21:04:50 lavajoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/ChangeLog,v 1.105 2011/09/15 22:05:48 ssuominen Exp $
+
+  15 Sep 2011; Samuli Suominen <ssuominen@gentoo.org> xv-3.10a-r16.ebuild,
+  files/xv-3.10a-libpng15.patch:
+  Enchance -libpng15.patch by _AxS_ from Freenode with some bits also from
+  NetBSD. Restore keywording as libpng15 is about to get unmasked and PNG
+  saving is working fine here (see bug #355883)
 
   12 Aug 2011; Joe Peterson <lavajoe@gentoo.org> xv-3.10a-r16.ebuild:
   Mask xv-3.10a-r16, since it breaks saving PNG files (see bug #355883)
index e3fe887b7f9d23c4ad1936557c1748d32fcb01c7..7165137c6e5989712bdb7d469c2293aba3ee3526 100644 (file)
@@ -1,13 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
 AUX xv-3.10a-add-ldflags-20070520.patch 757 RMD160 79231875612838a82b35692bd2e42da611299f8b SHA1 63eb1bd27bc412baa679a411aa3659c464fc9a8f SHA256 c63c7461b2bdae9f42828871522ffe384bd1bf3f1dd982a7ed7346e267531762
 AUX xv-3.10a-disable-jp2k-20070520.patch 589 RMD160 9c5ba21c35aac25ad06a2f3e2428ba9a8258c5ca SHA1 3e437c27016b0846d42f04ea0a17499af5374b05 SHA256 477c9e3684960e661679cbe0cce69218dfb9dccc006ff5bfe80eefb8e80d6ed2
 AUX xv-3.10a-fix-wait-20070520.patch 1664 RMD160 7d65d1ce5310ca7890ab426f41ce0bcf86f5dabc SHA1 4a7eb17085cca76702ac120ba021a46a5175a657 SHA256 840d8e0397367360004e23a26e27fa6074318bb20fc7ffcc575884369f66cece
-AUX xv-3.10a-libpng15.patch 17925 RMD160 aec3acbb42bbf28b4b528773f7eb74619edcf595 SHA1 f6325a7dd08cfc29289e56b83f7f66574491e0cf SHA256 97235b74a3ee0a0efdbbc736db2b1fc2feec4eadcf96e056f1b7003b27016df2
+AUX xv-3.10a-libpng15.patch 16471 RMD160 8f73a7d20321cecf4f4d74a7d71570a117001a17 SHA1 3d19aa0c6ecc8b554081906babe0b4f9a6946da3 SHA256 b06d04e38a13d25dd4ebf8913ee308c946ab27b94becc1ae9c928e89ed63f57e
 AUX xv-3.10a-osx-bsd-20070520.patch 1479 RMD160 27f6e665e4a6dad409d90b64eba5416d17fe60e9 SHA1 96fd3efc7c6ced3374aa4de15dbe983ab475fcb4 SHA256 fc801f9f3e4ebfc6f59f62e4dc15404b65654f1b46d1141794b249270d941114
 AUX xv-3.10a-vdcomp-osx-20070520.patch 437 RMD160 033c4340794a43400c67150a6c594909a6c52680 SHA1 5005c394564287d7e57f0c86fbc86b601c45c916 SHA256 e0d522ed4d835b8231aa5b3df1e401d9d1f6608eae2ec8ca7d415a11ff349d29
 AUX xv.png 2651 RMD160 9493aca7e4d60c9467f7501a151f2e5c9dbe3918 SHA1 8a02593d470b90da7c3944c55429cddaaa3505d8 SHA256 d2de01bf43ceaee4021e6fce7f165c29e2537971a7b20ec1ba6ed46bcb97d012
 DIST xv-3.10a-jumbo-patches-20070520.tar.gz 1363802 RMD160 23bc07030416ebaca5ce4d223921e33094c37b93 SHA1 d00308c1687d9d803d26ef40c73d19a0f593c626 SHA256 221ec89fdf0772bd09c845cbb337aecf411a1aee215140b676717f49e9e65c80
 DIST xv-3.10a.tar.gz 2259124 RMD160 7d545e0c0e5b0120a7d026ea549cba19a53fbc0d SHA1 9e6372f154be9e9e355972cbeb91d98d9c342474 SHA256 03eb26b1e8f315c3093f4ae794862ba46637d16c055e8efbe5e3beb5d40fc451
 EBUILD xv-3.10a-r15.ebuild 2579 RMD160 fca774da77c0681f3656f4fc37f332a15996201b SHA1 63d0b6469698ad4546101158fc0137e7530de003 SHA256 ffb0733229492bd37ec6d454fa99fb18d2e002b7f4ea5be7d555fea9d9589e1c
-EBUILD xv-3.10a-r16.ebuild 2613 RMD160 120460d015e8249aa32579642e54a405c74674e5 SHA1 c58edd7498a45efc5029037d7cb25616f9095819 SHA256 5caae3095150dff1617ff64792dc53392bf4d510b719fe8bcb71c7872e082e4b
-MISC ChangeLog 15045 RMD160 90ffced833c9f11216b5e257f6c3aa953f1bbfff SHA1 66133415908e5a99c405eeb9a11fefde12ff2161 SHA256 01a998c248c79fde17ec95fc14810bd1ed92f87cc5c2d87568df9ea18515875b
+EBUILD xv-3.10a-r16.ebuild 2595 RMD160 f38c469256898dcf1423ae8ed3233dadbf7880ad SHA1 21854fe785e9894bba79f4cd5688ce12b7935824 SHA256 cfd381a9e3aaec55c6dd72128818c97eb24e4d5c43d37ca9c62718fd902fb7aa
+MISC ChangeLog 15353 RMD160 840ed12f043bfdae576bfc8ca8f698f2157eb2d8 SHA1 b76399df518830a19d096a83557d237df8e0d569 SHA256 d397d559c399bcec683548e10406c89e374b4a08f566966876ea58aa3a583495
 MISC metadata.xml 223 RMD160 0c9c59654305e8789fe6c93fd07c561cfe003f54 SHA1 7904e6fb45104baf2cb67fb9886c633af4dc7056 SHA256 a24b49fe5448d4cb329acf1d8113ac30eb1d61d63a7319b66c077d3f1775d055
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.18 (GNU/Linux)
+
+iF4EAREIAAYFAk5ydvUACgkQXkR9YqOcLPHIpAD/acf/4iKBOjMI3ZN1+l0GeoDo
+HVT7voik62BwENZcFnEA/iAzNCZMm32b0V9bTYF0LCxXAx0r7o9GuTQ8PRtJOSse
+=MDZd
+-----END PGP SIGNATURE-----
index 94502c1528d2cc88406195791324ea688b492244..43c51766839ca5eb2913e5f6ea645b3e2475aa5a 100644 (file)
@@ -1,3 +1,14 @@
+--- xvinfo.c
++++ xvinfo.c
+@@ -26,7 +26,7 @@
+ #define INFOHIGH 270
+ 
+ /* max length of an Info String */
+-#define ISTRLEN 80
++#define ISTRLEN 256
+ 
+ /* baseline of top line of text */
+ #define TOPBASE (36 + penn_height/2 + 4 + 8 + ASCENT)
 --- xvpng.c
 +++ xvpng.c
 @@ -31,6 +31,7 @@
  #include "png.h"
  
  /*** Stuff for PNG Dialog box ***/
-@@ -41,7 +42,7 @@
+@@ -41,7 +42,9 @@
  #define COMPRESSION   6     /* default zlib compression level, not max
                                 (Z_BEST_COMPRESSION) */
  
 -#define HAVE_tRNS  (info_ptr->valid & PNG_INFO_tRNS)
-+#define HAVE_tRNS  (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
++/* old
++#define HAVE_tRNS  (info_ptr->valid & PNG_INFO_tRNS) */
++#define HAVE_tRNS  png_get_valid(png_ptr,info_ptr,PNG_INFO_tRNS)
  
  #define DWIDE    86
  #define DHIGH    104
-@@ -435,6 +436,16 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
- {
-   png_struct *png_ptr;
-   png_info   *info_ptr;
-+  struct {
-+    /* IHDR */
-+    png_uint_32 width;
-+    png_uint_32 height;
-+    int bit_depth;
-+    int color_type;
-+    int interlace_type;
-+    /* PLTE */
-+    int use_palette;
-+  } info_tmp;
-   png_color   palette[256];
-   png_textp   text;
-   byte        r1[256], g1[256], b1[256];  /* storage for deduped palette */
-@@ -444,6 +455,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -444,6 +447,10 @@
    byte       *p, *png_line;
    char        software[256];
    char       *savecmnt;
-+  int         num_text, max_text;
++  /* for storing values until all are accumulated, so that the image header can be set in full */
++  int         _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++  png_uint_32 _width,_height;
++  png_time    _mod_time;
  
    if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
         png_xv_error, png_xv_warning)) == NULL) {
-@@ -458,7 +470,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -458,7 +465,7 @@
      FatalError(software);
    }
  
      png_destroy_write_struct(&png_ptr, &info_ptr);
      return -1;
    }
-@@ -489,8 +501,8 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -489,8 +496,8 @@
      png_set_filter(png_ptr, 0, filter);
    }
  
 -  info_ptr->width = w;
 -  info_ptr->height = h;
-+  info_tmp.width = w;
-+  info_tmp.height = h;
++  _width = w;
++  _height = h;
    if (w <= 0 || h <= 0) {
      SetISTR(ISTR_WARNING, "%s:  image dimensions out of range (%dx%d)",
        fbasename, w, h);
-@@ -498,7 +510,8 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -498,7 +505,7 @@
      return -1;
    }
  
 -  info_ptr->interlace_type = interCB.val ? 1 : 0;
-+  info_tmp.interlace_type =
-+    interCB.val ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
++  _interlace_type = interCB.val ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
  
    linesize = 0;   /* quiet a compiler warning */
  
-@@ -542,40 +555,40 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -542,40 +549,44 @@
          png_destroy_write_struct(&png_ptr, &info_ptr);
          return -1;
        }
 -      info_ptr->color_type = PNG_COLOR_TYPE_RGB;
 -      info_ptr->bit_depth = 8;
-+      info_tmp.color_type = PNG_COLOR_TYPE_RGB;
-+      info_tmp.bit_depth = 8;
-+      info_tmp.use_palette = 0;
++      _color_type = PNG_COLOR_TYPE_RGB;
++      _bit_depth = 8;
      } else /* ptype == PIC8 */ {
        linesize = w;
 -      info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
-+      info_tmp.color_type = PNG_COLOR_TYPE_PALETTE;
++      _color_type = PNG_COLOR_TYPE_PALETTE;
        if (numuniqcols <= 2)
 -        info_ptr->bit_depth = 1;
-+        info_tmp.bit_depth = 1;
++        _bit_depth = 1;
        else
        if (numuniqcols <= 4)
 -        info_ptr->bit_depth = 2;
-+        info_tmp.bit_depth = 2;
++        _bit_depth = 2;
        else
        if (numuniqcols <= 16)
 -        info_ptr->bit_depth = 4;
-+        info_tmp.bit_depth = 4;
++        _bit_depth = 4;
        else
 -        info_ptr->bit_depth = 8;
-+        info_tmp.bit_depth = 8;
++        _bit_depth = 8;
  
        for (i = 0; i < numuniqcols; i++) {
          palette[i].red   = r1[i];
        }
 -      info_ptr->num_palette = numuniqcols;
 -      info_ptr->palette = palette;
--      info_ptr->valid |= PNG_INFO_PLTE;
-+      info_tmp.use_palette = 1;
++/* cannot find a setter for this, unsure if it is necessary anymore...
+       info_ptr->valid |= PNG_INFO_PLTE;
++*/
++      /* set the header just in case it's needed */
++      png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,
++        _interlace_type,PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
++      png_set_PLTE(png_ptr,info_ptr,palette,numuniqcols);
      }
    }
  
    else if (colorType == F_GREYSCALE || colorType == F_BWDITHER) {
 -    info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
-+    info_tmp.color_type = PNG_COLOR_TYPE_GRAY;
-+    info_tmp.use_palette = 0;
++    _color_type = PNG_COLOR_TYPE_GRAY;
      if (colorType == F_BWDITHER) {
        /* shouldn't happen */
        if (ptype == PIC24) FatalError("PIC24 and B/W Stipple in WritePNG()");
  
 -      info_ptr->bit_depth = 1;
-+      info_tmp.bit_depth = 1;
++      _bit_depth = 1;
        if (MONO(r1[0], g1[0], b1[0]) > MONO(r1[1], g1[1], b1[1])) {
          remap[0] = 1;
          remap[1] = 0;
-@@ -595,7 +608,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -595,7 +606,7 @@
            png_destroy_write_struct(&png_ptr, &info_ptr);
            return -1;
          }
 -        info_ptr->bit_depth = 8;
-+        info_tmp.bit_depth = 8;
++        _bit_depth = 8;
        }
        else /* ptype == PIC8 */ {
          int low_precision;
-@@ -617,7 +630,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -617,7 +628,7 @@
          for (; i < 256; i++)
            remap[i]=0;  /* shouldn't be necessary, but... */
  
 -        info_ptr->bit_depth = 8;
-+        info_tmp.bit_depth = 8;
++        _bit_depth = 8;
  
          /* Note that this fails most of the time because of gamma */
             /* (and that would be a bug:  GRR FIXME) */
-@@ -636,7 +649,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -636,7 +647,7 @@
            for (i = 0; i < numuniqcols; i++) {
              remap[i] &= 0xf;
            }
 -          info_ptr->bit_depth = 4;
-+          info_tmp.bit_depth = 4;
++          _bit_depth = 4;
  
            /* try to adjust to 2-bit precision grayscale */
  
-@@ -652,7 +665,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -652,7 +663,7 @@
            for (i = 0; i < numuniqcols; i++) {
              remap[i] &= 3;
            }
 -          info_ptr->bit_depth = 2;
-+          info_tmp.bit_depth = 2;
++          _bit_depth = 2;
  
            /* try to adjust to 1-bit precision grayscale */
  
-@@ -668,7 +681,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -668,7 +679,7 @@
            for (i = 0; i < numuniqcols; i++) {
              remap[i] &= 1;
            }
 -          info_ptr->bit_depth = 1;
-+          info_tmp.bit_depth = 1;
++          _bit_depth = 1;
          }
        }
      }
-@@ -677,6 +690,20 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -677,6 +688,9 @@
    else
      png_error(png_ptr, "Unknown colorstyle in WritePNG");
  
-+  png_set_IHDR(png_ptr, info_ptr,
-+             info_tmp.width, info_tmp.height,
-+             info_tmp.bit_depth, info_tmp.color_type,
-+             info_tmp.interlace_type, PNG_COMPRESSION_TYPE_BASE,
-+             PNG_FILTER_TYPE_BASE);
-+  if (info_tmp.use_palette) {
-+    /*
-+     * info_ptr->num_palette = numuniqcols;
-+     * info_ptr->palette = palette;
-+     * info_ptr->valid |= PNG_INFO_PLTE;
-+     */
-+    png_set_PLTE(png_ptr, info_ptr, palette, numuniqcols);
-+  }
++  png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,
++    _interlace_type,PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
 +
    if ((text = (png_textp)malloc(sizeof(png_text)))) {
      sprintf(software, "XV %s", REVDATE);
  
-@@ -684,21 +711,29 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
-     text->key = "Software";
+@@ -685,20 +699,22 @@
      text->text = software;
      text->text_length = strlen(text->text);
-+    text->lang = NULL;
  
 -    info_ptr->max_text = 1;
 -    info_ptr->num_text = 1;
 -    info_ptr->text = text;
-+    /*
-+     * info_ptr->max_text = 1;
-+     * info_ptr->num_text = 1;
-+     * info_ptr->text = text;
-+     */
-+    png_set_text(png_ptr, info_ptr, text, 1);
-+    num_text = max_text = 1;
++/* max_text seems to be internal only now, do not set
++    info_ptr->max_text = 1; */
++    png_set_text(png_ptr,info_ptr,text,1);
    }
  
    Display_Gamma = gDial.val;  /* Save the current gamma for loading */
  // GRR FIXME:  add .Xdefaults option to omit writing gamma (size, cumulative errors when editing)--alternatively, modify save box to include "omit" checkbox
 -  info_ptr->gamma = 1.0/gDial.val;
 -  info_ptr->valid |= PNG_INFO_gAMA;
-+  /*
-+   * info_ptr->gamma = 1.0/gDial.val;
-+   * info_ptr->valid |= PNG_INFO_gAMA;
-+   */
-+  png_set_gAMA(png_ptr, info_ptr, 1.0/gDial.val);
++  png_set_gAMA(png_ptr,info_ptr,1.0/gDial.val);
++/* doesn't seem to be a way to set valid directly anymore, unnecessary maybe.. 
++  info_ptr->valid |= PNG_INFO_gAMA; */
  
++/* might need to be png_write_info_before_PLTE() ... */
    png_write_info(png_ptr, info_ptr);
  
 -  if (info_ptr->bit_depth < 8)
-+  if (info_tmp.bit_depth < 8)
++  if (_bit_depth < 8)
      png_set_packing(png_ptr);
  
    pass=png_set_interlace_handling(png_ptr);
-@@ -711,13 +746,13 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -711,13 +727,13 @@
      int j;
      p = pic;
      for (j = 0; j < h; ++j) {
 -      if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
-+      if (info_tmp.color_type == PNG_COLOR_TYPE_GRAY) {
++      if (_color_type == PNG_COLOR_TYPE_GRAY) {
          int k;
          for (k = 0; k < w; ++k)
            png_line[k] = ptype==PIC24 ? MONO(p[k*3], p[k*3+1], p[k*3+2]) :
                                         remap[pc2nc[p[k]]];
          png_write_row(png_ptr, png_line);
 -      } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
-+      } else if (info_tmp.color_type == PNG_COLOR_TYPE_PALETTE) {
++      } else if (_color_type == PNG_COLOR_TYPE_PALETTE) {
          int k;
          for (k = 0; k < w; ++k)
            png_line[k] = pc2nc[p[k]];
-@@ -743,24 +778,26 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -739,28 +755,31 @@
+         (savecmnt = (char *)malloc((strlen(picComments) + 1)*sizeof(char)))) {
+       png_textp tp;
+       char *comment, *key;
++      int nt;
++      int mt;
+ 
        strcpy(savecmnt, picComments);
        key = savecmnt;
++      png_get_text(png_ptr,info_ptr,&tp,&mt); /* to get 'max_text' */
        tp = text;
 -      info_ptr->num_text = 0;
-+
-+      png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
-+      num_text = 0;
++      nt = 0;      
  
        comment = strchr(key, ':');
  
        do  {
          /* Allocate a larger structure for comments if necessary */
 -        if (info_ptr->num_text >= info_ptr->max_text)
-+        if (num_text >= max_text)
++        if (nt >= mt)
          {
            if ((tp =
 -              realloc(text, (info_ptr->num_text + 2)*sizeof(png_text))) == NULL)
-+              realloc(text, (num_text + 2)*sizeof(png_text))) == NULL)
++              realloc(text, (nt + 2)*sizeof(png_text))) == NULL)
            {
              break;
            }
              text = tp;
 -            tp = &text[info_ptr->num_text];
 -            info_ptr->max_text += 2;
-+            tp = &text[num_text];
-+            max_text += 2;
++            tp = &text[nt];
++            mt += 2;
            }
          }
  
-@@ -810,7 +847,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -810,7 +829,7 @@
              }
  
              tp->compression = tp->text_length > 640 ? 0 : -1;
 -            info_ptr->num_text++;
-+            num_text++;
++            nt++;
              tp++;
            }
          }
-@@ -834,27 +871,29 @@ int WritePNG(fp, pic, ptype, w, h, rmap,
+@@ -834,27 +853,29 @@
            tp->text = key;
            tp->text_length = q - key;
            tp->compression = tp->text_length > 750 ? 0 : -1;
 -          info_ptr->num_text++;
-+          num_text++;
++          nt++;
            key = NULL;
          }
        } while (key && *key);
-+      png_set_text(png_ptr, info_ptr, text, num_text);
++      png_set_text(png_ptr,info_ptr,text,nt);
      }
      else {
 -      info_ptr->num_text = 0;
-+      png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
++      png_set_text(png_ptr,info_ptr,text,0);
      }
    }
 -  info_ptr->text = text;
  
 -  png_convert_from_time_t(&(info_ptr->mod_time), time(NULL));
 -  info_ptr->valid |= PNG_INFO_tIME;
-+  {
-+     png_time mod_time;
-+
-+     png_convert_from_time_t(&mod_time, time(NULL));
-+     png_set_tIME(png_ptr, info_ptr, &mod_time);
-+  }
++  png_convert_from_time_t(&_mod_time, time(NULL));
++  png_set_tIME(png_ptr,info_ptr,&_mod_time);
++/* dunno how to set validity
++  info_ptr->valid |= PNG_INFO_tIME; */
  
    png_write_end(png_ptr, info_ptr);
    fflush(fp);   /* just in case we core-dump before finishing... */
      free(text);
 -    /* must do this or png_destroy_write_struct() 0.97+ will free text again: */
 -    info_ptr->text = (png_textp)NULL;
++    /* must do this or png_destroy_write_struct() 0.97+ will free text again: 
++    info_ptr->text = (png_textp)NULL; */
      if (savecmnt)
      {
        free(savecmnt);
-@@ -886,6 +925,8 @@ int LoadPNG(fname, pinfo)
+@@ -886,6 +907,14 @@
    int pass;
    int gray_to_rgb;
    size_t commentsize;
-+  png_textp text;
-+  int num_text;
++  /* temp storage vars for libpng15 migration */
++  int         _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type,_num_text,_num_palette;
++  png_uint_32 _width,_height;
++  png_timep   _mod_time;
++  double      _gamma;
++  png_textp   _text;
++  png_colorp  _palette;
++  png_color_16p _background;
  
    fbasename = BaseName(fname);
  
-@@ -921,7 +962,7 @@ int LoadPNG(fname, pinfo)
+@@ -921,7 +950,7 @@
      FatalError("malloc failure in LoadPNG");
    }
  
      fclose(fp);
      png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
      if (!read_anything) {
-@@ -945,8 +986,8 @@ int LoadPNG(fname, pinfo)
+@@ -945,8 +974,10 @@
  #endif
    png_read_info(png_ptr, info_ptr);
  
 -  pinfo->w = pinfo->normw = info_ptr->width;
 -  pinfo->h = pinfo->normh = info_ptr->height;
-+  pinfo->w = pinfo->normw = png_get_image_width(png_ptr, info_ptr);
-+  pinfo->h = pinfo->normh = png_get_image_height(png_ptr, info_ptr);
++  png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,&_interlace_type,NULL,NULL);
++
++  pinfo->w = pinfo->normw = _width;
++  pinfo->h = pinfo->normh = _height;
    if (pinfo->w <= 0 || pinfo->h <= 0) {
      SetISTR(ISTR_WARNING, "%s:  image dimensions out of range (%dx%d)",
        fbasename, pinfo->w, pinfo->h);
-@@ -957,9 +998,9 @@ int LoadPNG(fname, pinfo)
+@@ -957,9 +988,9 @@
    pinfo->frmType = F_PNG;
  
    sprintf(pinfo->fullInfo, "PNG, %d bit ",
 -          info_ptr->bit_depth * info_ptr->channels);
-+          png_get_bit_depth(png_ptr,info_ptr) * png_get_channels(png_ptr, info_ptr));
++          _bit_depth * png_get_channels(png_ptr,info_ptr));
  
 -  switch(info_ptr->color_type) {
-+  switch(png_get_color_type(png_ptr, info_ptr)) {
++  switch(_color_type) {
      case PNG_COLOR_TYPE_PALETTE:
        strcat(pinfo->fullInfo, "palette color");
        break;
-@@ -983,15 +1024,20 @@ int LoadPNG(fname, pinfo)
+@@ -983,15 +1014,17 @@
  
    sprintf(pinfo->fullInfo + strlen(pinfo->fullInfo),
          ", %sinterlaced. (%d bytes)",
 -        info_ptr->interlace_type ? "" : "non-", filesize);
-+        png_get_interlace_type(png_ptr, info_ptr) ? "" : "non-", filesize);
++        _interlace_type ? "" : "non-", filesize);
  
 -  sprintf(pinfo->shrtInfo, "%lux%lu PNG", info_ptr->width, info_ptr->height);
-+  sprintf(pinfo->shrtInfo, "%lux%lu PNG",
-+        png_get_image_width(png_ptr, info_ptr),
-+        png_get_image_height(png_ptr, info_ptr));
++  sprintf(pinfo->shrtInfo, "%lux%lu PNG", _width, _height);
  
 -  if (info_ptr->bit_depth < 8)
-+  if (png_get_bit_depth(png_ptr, info_ptr) < 8)
++  if (_bit_depth < 8)
        png_set_packing(png_ptr);
  
 -  if (info_ptr->valid & PNG_INFO_gAMA)
 -    png_set_gamma(png_ptr, Display_Gamma, info_ptr->gamma);
-+  if (png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA)) {
-+    double gamma;
-+    png_get_gAMA(png_ptr, info_ptr, &gamma);
-+    png_set_gamma(png_ptr, Display_Gamma, gamma);
++  if (png_get_valid(png_ptr,info_ptr,PNG_INFO_gAMA)) {
++    png_get_gAMA(png_ptr,info_ptr,&_gamma);
++    png_set_gamma(png_ptr, Display_Gamma, _gamma);
 +  }
  /*
   *else
   *  png_set_gamma(png_ptr, Display_Gamma, 0.45);
-@@ -1000,7 +1046,7 @@ int LoadPNG(fname, pinfo)
+@@ -1000,7 +1033,7 @@
    gray_to_rgb = 0;   /* quiet a compiler warning */
  
    if (have_imagebg) {
 -    if (info_ptr->bit_depth == 16) {
-+    if (png_get_bit_depth(png_ptr, info_ptr) == 16) {
++    if (_bit_depth == 16) {
        my_background.red   = imagebgR;
        my_background.green = imagebgG;
        my_background.blue  = imagebgB;
-@@ -1013,8 +1059,8 @@ int LoadPNG(fname, pinfo)
+@@ -1013,8 +1046,8 @@
      }
      png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN,
                         0, Display_Gamma);
 -    if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
 -         (info_ptr->color_type == PNG_COLOR_TYPE_GRAY && HAVE_tRNS)) &&
-+    if ((png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA ||
-+         (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY && HAVE_tRNS)) &&
++    if ((_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
++         (_color_type == PNG_COLOR_TYPE_GRAY && HAVE_tRNS)) &&
          (imagebgR != imagebgG || imagebgR != imagebgB))  /* i.e., colored bg */
      {
        png_set_gray_to_rgb(png_ptr);
-@@ -1022,8 +1068,10 @@ int LoadPNG(fname, pinfo)
+@@ -1022,8 +1055,9 @@
        gray_to_rgb = 1;
      }
    } else {
 -    if (info_ptr->valid & PNG_INFO_bKGD) {
 -      png_set_background(png_ptr, &info_ptr->background,
-+    if (png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD)) {
-+      png_color_16p background;
-+      png_get_bKGD(png_ptr, info_ptr, &background);
-+      png_set_background(png_ptr, background,
++    if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) {
++      png_get_bKGD(png_ptr,info_ptr,&_background);
++      png_set_background(png_ptr, _background,
                           PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
      } else {
        my_background.red = my_background.green = my_background.blue =
-@@ -1033,13 +1081,13 @@ int LoadPNG(fname, pinfo)
+@@ -1033,13 +1067,13 @@
      }
    }
  
 -  if (info_ptr->bit_depth == 16)
-+  if (png_get_bit_depth(png_ptr, info_ptr) == 16)
++  if (_bit_depth == 16)
      png_set_strip_16(png_ptr);
  
 -  if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
 -      info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
-+      png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
++  if (_color_type == PNG_COLOR_TYPE_GRAY ||
++      _color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
    {
 -    if (info_ptr->bit_depth == 1)
-+    if (png_get_bit_depth(png_ptr, info_ptr) == 1)
++    if (_bit_depth == 1)
        pinfo->colType = F_BWDITHER;
      else
        pinfo->colType = F_GREYSCALE;
-@@ -1050,8 +1098,8 @@ int LoadPNG(fname, pinfo)
+@@ -1049,9 +1083,11 @@
+   pass=png_set_interlace_handling(png_ptr);
  
    png_read_update_info(png_ptr, info_ptr);
++  /* get HIDR again just in case the info_ptr changed */
++  png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,&_interlace_type,NULL,NULL);
  
 -  if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
 -     info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb)
-+  if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB ||
-+     png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb)
++  if (_color_type == PNG_COLOR_TYPE_RGB ||
++     _color_type == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb)
    {
      linesize = 3 * pinfo->w;
      if (linesize/3 < pinfo->w) {   /* know pinfo->w > 0 (see above) */
-@@ -1065,16 +1113,20 @@ int LoadPNG(fname, pinfo)
+@@ -1065,16 +1101,17 @@
    } else {
      linesize = pinfo->w;
      pinfo->type = PIC8;
 -    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
 -       info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
-+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
-+       png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA) {
++    if (_color_type == PNG_COLOR_TYPE_GRAY ||
++       _color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
        for (i = 0; i < 256; i++)
          pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
      } else {
-+      png_colorp palette;
-+      int num_palette;
-+
-+      png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
        pinfo->colType = F_FULLCOLOR;
 -      for (i = 0; i < info_ptr->num_palette; i++) {
 -        pinfo->r[i] = info_ptr->palette[i].red;
 -        pinfo->g[i] = info_ptr->palette[i].green;
 -        pinfo->b[i] = info_ptr->palette[i].blue;
-+      for (i = 0; i < num_palette; i++) {
-+        pinfo->r[i] = palette[i].red;
-+        pinfo->g[i] = palette[i].green;
-+        pinfo->b[i] = palette[i].blue;
++      png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++      for (i = 0; i < _num_palette; i++) {
++        pinfo->r[i] = _palette[i].red;
++        pinfo->g[i] = _palette[i].green;
++        pinfo->b[i] = _palette[i].blue;
        }
      }
    }
-@@ -1092,7 +1144,17 @@ int LoadPNG(fname, pinfo)
+@@ -1092,7 +1129,7 @@
      png_error(png_ptr, "can't allocate space for PNG image");
    }
  
 -  png_start_read_image(png_ptr);
-+  /*
-+   * In png 1.5 (or at least 1.5.1beta06) calling this after calling
-+   * png_read_update_info() does nothing besides issue a misleading
-+   * warning message. The png docs are not at all clear on what an
-+   * application is *supposed* to do, so I'm not sure if this is a
-+   * problem with xv or with libpng. However, for now I'll comment
-+   * this out as according to the png source that should be harmless
-+   * and we don't want to see the warning message every time someone
-+   * opens a png.
-+   */
-+  /*png_start_read_image(png_ptr);*/
++  /*png_start_read_image(png_ptr); -- causes a warning and seems to be unnecessary */
  
    for (i = 0; i < pass; i++) {
      byte *p = pinfo->pic;
-@@ -1106,22 +1168,23 @@ int LoadPNG(fname, pinfo)
+@@ -1106,22 +1143,23 @@
  
    png_read_end(png_ptr, info_ptr);
  
 -  if (info_ptr->num_text > 0) {
-+  png_get_text(png_ptr, info_ptr, &text, &num_text);
-+  if (num_text > 0) {
++  png_get_text(png_ptr,info_ptr,&_text,&_num_text);
++  if (_num_text > 0) {
      commentsize = 1;
  
 -    for (i = 0; i < info_ptr->num_text; i++)
 -      commentsize += strlen(info_ptr->text[i].key) + 1 +
 -                     info_ptr->text[i].text_length + 2;
-+    for (i = 0; i < num_text; i++)
-+      commentsize += strlen(text[i].key) + 1 +
-+                     text[i].text_length + 2;
++    for (i = 0; i < _num_text; i++)
++      commentsize += strlen(_text[i].key) + 1 +
++                     _text[i].text_length + 2;
  
      if ((pinfo->comment = malloc(commentsize)) == NULL) {
        png_warning(png_ptr,"can't allocate comment string");
        pinfo->comment[0] = '\0';
 -      for (i = 0; i < info_ptr->num_text; i++) {
 -        strcat(pinfo->comment, info_ptr->text[i].key);
-+      for (i = 0; i < num_text; i++) {
-+        strcat(pinfo->comment, text[i].key);
++      for (i = 0; i < _num_text; i++) {
++        strcat(pinfo->comment, _text[i].key);
          strcat(pinfo->comment, "::");
 -        strcat(pinfo->comment, info_ptr->text[i].text);
-+        strcat(pinfo->comment, text[i].text);
++        strcat(pinfo->comment, _text[i].text);
          strcat(pinfo->comment, "\n");
        }
      }
-@@ -1143,7 +1206,7 @@ png_xv_error(png_ptr, message)
+@@ -1143,7 +1181,7 @@
  {
    SetISTR(ISTR_WARNING,"%s:  libpng error: %s", fbasename, message);
  
index 866900b22b4cfff1bc3148a350b1afcce1eb9d40..65af48a69fc4ccd554f9d071d4396ce1d8e35176 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r16.ebuild,v 1.2 2011/08/12 21:04:50 lavajoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/xv/xv-3.10a-r16.ebuild,v 1.3 2011/09/15 22:05:48 ssuominen Exp $
 
 EAPI=2
 inherit eutils flag-o-matic
@@ -12,13 +12,13 @@ SRC_URI="mirror://sourceforge/png-mng/${P}-jumbo-patches-${JUMBOV}.tar.gz ftp://
 
 LICENSE="xv"
 SLOT="0"
-#KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
 IUSE="jpeg tiff png"
 
 DEPEND="x11-libs/libXt
        jpeg? ( virtual/jpeg )
-       tiff? ( >=media-libs/tiff-3.6.1-r2 )
-       png? ( >=media-libs/libpng-1.2 >=sys-libs/zlib-1.1.4 )"
+       tiff? ( media-libs/tiff )
+       png? ( >=media-libs/libpng-1.4 sys-libs/zlib )"
 RDEPEND="${DEPEND}"
 
 src_prepare() {