Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 263343 Details for
Bug 355883
media-gfx/xv-3.10a-r15 fails to build with libpng-1.5
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
half assed attempt
xv-libpng-1.5.patch (text/plain), 6.53 KB, created by
SpanKY
on 2011-02-21 17:58:54 UTC
(
hide
)
Description:
half assed attempt
Filename:
MIME Type:
Creator:
SpanKY
Created:
2011-02-21 17:58:54 UTC
Size:
6.53 KB
patch
obsolete
>--- xvpng.c. 2011-02-21 12:47:56.000000000 -0500 >+++ xvpng.c 2011-02-21 12:56:50.000000000 -0500 >@@ -31,6 +31,7 @@ > > #ifdef HAVE_PNG > >+#include "zlib.h" > #include "png.h" > > /*** Stuff for PNG Dialog box ***/ >@@ -99,14 +100,14 @@ > /* fread() returns 0 on error, so it is OK to store this in a png_size_t > * instead of an int, which is what fread() actually returns. > */ >- if (fread(data,1,length,(FILE *)png_ptr->io_ptr) != length) >+ if (fread(data, 1, length, png_get_io_ptr(png_ptr)) != length) > png_error(png_ptr, "Read Error"); > } > > static void > png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) > { >- if (fwrite(data, 1, length, (FILE *)png_ptr->io_ptr) != length) >+ if (fwrite(data, 1, length, png_get_io_ptr(png_ptr)) != length) > png_error(png_ptr, "Write Error"); > } > #endif /* PNG_NO_STDIO */ >@@ -441,6 +442,7 @@ > byte pc2nc[256]; /* for duplicated-color remapping (1st level) */ > byte remap[256]; /* for bw/grayscale remapping (2nd level) */ > int i, j, numuniqcols=0, filter, linesize, pass; >+ int bit_depth, color_type; > byte *p, *png_line; > char software[256]; > char *savecmnt; >@@ -458,7 +460,7 @@ > FatalError(software); > } > >- if (setjmp(png_ptr->jmpbuf)) { >+ if (setjmp(png_jmpbuf(png_ptr))) { > png_destroy_write_struct(&png_ptr, &info_ptr); > return -1; > } >@@ -489,8 +491,6 @@ > png_set_filter(png_ptr, 0, filter); > } > >- info_ptr->width = w; >- info_ptr->height = h; > if (w <= 0 || h <= 0) { > SetISTR(ISTR_WARNING, "%s: image dimensions out of range (%dx%d)", > fbasename, w, h); >@@ -498,8 +498,6 @@ > return -1; > } > >- info_ptr->interlace_type = interCB.val ? 1 : 0; >- > linesize = 0; /* quiet a compiler warning */ > > >@@ -542,40 +540,39 @@ > png_destroy_write_struct(&png_ptr, &info_ptr); > return -1; > } >- info_ptr->color_type = PNG_COLOR_TYPE_RGB; >- info_ptr->bit_depth = 8; >+ color_type = PNG_COLOR_TYPE_RGB; >+ bit_depth = 8; > } else /* ptype == PIC8 */ { > linesize = w; >- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; >+ color_type = PNG_COLOR_TYPE_PALETTE; > if (numuniqcols <= 2) >- info_ptr->bit_depth = 1; >+ bit_depth = 1; > else > if (numuniqcols <= 4) >- info_ptr->bit_depth = 2; >+ bit_depth = 2; > else > if (numuniqcols <= 16) >- info_ptr->bit_depth = 4; >+ bit_depth = 4; > else >- info_ptr->bit_depth = 8; >+ bit_depth = 8; > > for (i = 0; i < numuniqcols; i++) { > palette[i].red = r1[i]; > palette[i].green = g1[i]; > palette[i].blue = b1[i]; > } >- info_ptr->num_palette = numuniqcols; >- info_ptr->palette = palette; >+ png_set_PLTE(png_ptr, info_ptr, palette, numuniqcols); > info_ptr->valid |= PNG_INFO_PLTE; > } > } > > else if (colorType == F_GREYSCALE || colorType == F_BWDITHER) { >- info_ptr->color_type = PNG_COLOR_TYPE_GRAY; >+ 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; >+ 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 +592,7 @@ > png_destroy_write_struct(&png_ptr, &info_ptr); > return -1; > } >- info_ptr->bit_depth = 8; >+ bit_depth = 8; > } > else /* ptype == PIC8 */ { > int low_precision; >@@ -617,7 +614,7 @@ > for (; i < 256; i++) > remap[i]=0; /* shouldn't be necessary, but... */ > >- info_ptr->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 +633,7 @@ > for (i = 0; i < numuniqcols; i++) { > remap[i] &= 0xf; > } >- info_ptr->bit_depth = 4; >+ bit_depth = 4; > > /* try to adjust to 2-bit precision grayscale */ > >@@ -652,7 +649,7 @@ > for (i = 0; i < numuniqcols; i++) { > remap[i] &= 3; > } >- info_ptr->bit_depth = 2; >+ bit_depth = 2; > > /* try to adjust to 1-bit precision grayscale */ > >@@ -668,7 +665,7 @@ > for (i = 0; i < numuniqcols; i++) { > remap[i] &= 1; > } >- info_ptr->bit_depth = 1; >+ bit_depth = 1; > } > } > } >@@ -677,6 +674,9 @@ > else > png_error(png_ptr, "Unknown colorstyle in WritePNG"); > >+ png_set_IHDR(png_ptr, info_ptr, w, h, bit_depth, color_type, >+ interCB.val ? 1 : 0, 0, 0); >+ > if ((text = (png_textp)malloc(sizeof(png_text)))) { > sprintf(software, "XV %s", REVDATE); > >@@ -686,19 +686,18 @@ > text->text_length = strlen(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); > } > > 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; >+ png_set_gamma(png_ptr, 1.0/gDial.val, 0); > info_ptr->valid |= PNG_INFO_gAMA; > > png_write_info(png_ptr, info_ptr); > >- if (info_ptr->bit_depth < 8) >+ if (bit_depth < 8) > png_set_packing(png_ptr); > > pass=png_set_interlace_handling(png_ptr); >@@ -711,13 +710,13 @@ > int j; > p = pic; > for (j = 0; j < h; ++j) { >- if (info_ptr->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 (color_type == PNG_COLOR_TYPE_PALETTE) { > int k; > for (k = 0; k < w; ++k) > png_line[k] = pc2nc[p[k]]; >@@ -921,7 +920,7 @@ > FatalError("malloc failure in LoadPNG"); > } > >- if (setjmp(png_ptr->jmpbuf)) { >+ if (setjmp(png_jmpbuf(png_ptr))) { > fclose(fp); > png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); > if (!read_anything) { >@@ -1143,7 +1142,7 @@ > { > SetISTR(ISTR_WARNING,"%s: libpng error: %s", fbasename, message); > >- longjmp(png_ptr->jmpbuf, 1); >+ longjmp(png_jmpbuf(png_ptr), 1); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 355883
: 263343