diff options
author | thierry <thierry@FreeBSD.org> | 2006-04-30 22:50:54 +0800 |
---|---|---|
committer | thierry <thierry@FreeBSD.org> | 2006-04-30 22:50:54 +0800 |
commit | 0f54ab5e933660294064bd2716bbe3d06052fb8b (patch) | |
tree | 35f5d17d19eecea37861d754a4d5ac0636d87b63 /graphics/fbm | |
parent | fa815ee4a5413acc2fac9e16070961fc30b8512c (diff) | |
download | freebsd-ports-gnome-0f54ab5e933660294064bd2716bbe3d06052fb8b.tar.gz freebsd-ports-gnome-0f54ab5e933660294064bd2716bbe3d06052fb8b.tar.zst freebsd-ports-gnome-0f54ab5e933660294064bd2716bbe3d06052fb8b.zip |
Add RLE support.
PR: ports/93839
Submitted by: Pedro F. Giffuni <giffunip (at) asme.org>
Diffstat (limited to 'graphics/fbm')
-rw-r--r-- | graphics/fbm/Makefile | 2 | ||||
-rw-r--r-- | graphics/fbm/files/patch-aa | 18 | ||||
-rw-r--r-- | graphics/fbm/files/patch-fbm.h | 11 | ||||
-rw-r--r-- | graphics/fbm/files/patch-flrle.c | 228 |
4 files changed, 251 insertions, 8 deletions
diff --git a/graphics/fbm/Makefile b/graphics/fbm/Makefile index ab132727e4af..e608e2c34bab 100644 --- a/graphics/fbm/Makefile +++ b/graphics/fbm/Makefile @@ -15,6 +15,8 @@ EXTRACT_SUFX= .tgz MAINTAINER= ports@FreeBSD.org COMMENT= Fuzzy Pixmap Manipulation utilities +LIB_DEPENDS= rle.1:${PORTSDIR}/graphics/urt + NO_WRKSUBDIR= yes NO_LATEST_LINK= yes diff --git a/graphics/fbm/files/patch-aa b/graphics/fbm/files/patch-aa index c36f210469a2..39cb99cee3e0 100644 --- a/graphics/fbm/files/patch-aa +++ b/graphics/fbm/files/patch-aa @@ -1,5 +1,5 @@ ---- Makefile.orig Fri Jun 4 01:30:50 1993 -+++ Makefile Thu Apr 27 03:27:43 2000 +--- Makefile.orig Thu Jun 3 16:30:50 1993 ++++ Makefile Thu Jan 13 16:54:56 2005 @@ -63,32 +63,33 @@ # ################################################################ @@ -16,8 +16,8 @@ MANEXT= l +MAN= $(PREFIX)/man/man$(MANEXT)/ +FTP= /usr/mlm/ftp/ -+TIFINC= $(LOCALBASE)/include/ -+TIFLIB= $(LOCALBASE)/lib/ ++TIFINC= -I$(LOCALBASE)/include/ ++TIFLIB= -L$(LOCALBASE)/lib -ltiff # Make the C compiler behave on the NeXT -DBG= -g -D__STRICT_BSD__ @@ -37,13 +37,15 @@ #----------------Utah RLE linkage---------------- # If you don't have the Utah RLE library, use these two lines - RLE= - RLIB= +-RLE= +-RLIB= ++#RLE= ++#RLIB= # If you have the Utah RLE library, use the next lines instead -#RLE= -DRLE -I/usr/mlm/include -#RLIB= -L. -lfbm -L/usr/mlm/lib -lrle -+#RLE= -DRLE -I$(LOCALBASE)/include -+#RLIB= -L. -lfbm -L$(LOCALBASE)/lib -lrle ++RLE= -DRLE -I$(LOCALBASE)/include ++RLIB= -L. -lfbm -L$(LOCALBASE)/lib -lrle LIB= -L. -lfbm $(JLIB) $(RLIB) diff --git a/graphics/fbm/files/patch-fbm.h b/graphics/fbm/files/patch-fbm.h new file mode 100644 index 000000000000..bc979f59b30d --- /dev/null +++ b/graphics/fbm/files/patch-fbm.h @@ -0,0 +1,11 @@ +--- fbm.h.orig Sat Feb 25 15:15:18 2006 ++++ fbm.h Sat Feb 25 15:17:11 2006 +@@ -113,7 +113,7 @@ + char *strcpy(); + char *strncpy(); + +-#ifndef _COMPAT_ ++#ifdef _COMPAT_ + char *malloc(); + #endif + diff --git a/graphics/fbm/files/patch-flrle.c b/graphics/fbm/files/patch-flrle.c new file mode 100644 index 000000000000..84b130abe11f --- /dev/null +++ b/graphics/fbm/files/patch-flrle.c @@ -0,0 +1,228 @@ +--- flrle.c.orig Mon Jun 25 04:49:20 1990 ++++ flrle.c Thu Jan 13 17:29:17 2005 +@@ -31,7 +31,7 @@ + + #ifdef RLE + +-#include "svfb_global.h" ++#include "rle.h" + + #define CMAP_COLORS 3 + +@@ -82,6 +82,9 @@ + int planes; + int rowlen; + int plnlen; ++ rle_hdr out_hdr; ++ ++ out_hdr = *rle_hdr_init( (rle_hdr *)0 ); + + if (image->hdr.physbits != 8) { + fputs ("write_rle: error: can only handle 8 physical bits per pixel\n", +@@ -95,19 +98,19 @@ + rowlen = image->hdr.rowlen; + plnlen = image->hdr.plnlen; + +- sv_globals.sv_ncolors = planes; +- sv_globals.sv_alpha = 0; /* no alpha channel */ +- sv_globals.sv_background = 2; /* clear background to sv_bg_color */ +- sv_globals.sv_xmin = 0; +- sv_globals.sv_xmax = cols - 1; +- sv_globals.sv_ymin = 0; +- sv_globals.sv_ymax = rows - 1; +- sv_globals.sv_cmaplen = 0; /* log2(color_map_length) */ ++ out_hdr.ncolors = planes; ++ out_hdr.alpha = 0; /* no alpha channel */ ++ out_hdr.background = 2; /* clear background to bg_color */ ++ out_hdr.xmin = 0; ++ out_hdr.xmax = cols - 1; ++ out_hdr.ymin = 0; ++ out_hdr.ymax = rows - 1; ++ out_hdr.cmaplen = 0; /* log2(color_map_length) */ + if (image->hdr.clrlen > 0) { +- sv_globals.sv_ncmap = CMAP_COLORS; ++ out_hdr.ncmap = CMAP_COLORS; + + for (i = 1; i < image->hdr.clrlen / CMAP_COLORS; i <<= 1) +- sv_globals.sv_cmaplen++; ++ out_hdr.cmaplen++; + + if ((colorMap = (rle_map *)malloc(image->hdr.clrlen*sizeof(rle_map))) == + (rle_map *)NULL) +@@ -117,15 +120,15 @@ + } + for (i = 0; i < image->hdr.clrlen; i++) + colorMap[i] = (rle_map)image->cm[i] << 8; +- sv_globals.sv_cmap = colorMap; ++ out_hdr.cmap = colorMap; + } + else { +- sv_globals.sv_ncmap = 0; +- sv_globals.sv_cmap = (rle_map *)NULL; ++ out_hdr.ncmap = 0; ++ out_hdr.cmap = (rle_map *)NULL; + } + + for (channel = 0; channel < planes; channel++) +- SV_SET_BIT (sv_globals, channel); ++ RLE_SET_BIT (out_hdr, channel); + + if (*image->hdr.title != '\0') + sprintf (CommentBuf (cp++), "%s=%s", +@@ -144,7 +147,7 @@ + * in a comment. + */ + if (image->hdr.clrlen > 0 && +- (1 << sv_globals.sv_cmaplen) != image->hdr.clrlen / CMAP_COLORS) ++ (1 << out_hdr.cmaplen) != image->hdr.clrlen / CMAP_COLORS) + { + sprintf (CommentBuf (cp++), "%s=%d", + CMAP_COMMENT, image->hdr.clrlen / CMAP_COLORS); +@@ -152,11 +155,11 @@ + + *cp = (char *)NULL; + +- sv_globals.sv_comments = cp > comments ? comments : (char **)NULL; ++ out_hdr.comments = cp > comments ? comments : (char **)NULL; + +- sv_globals.svfb_fd = wfile; ++ out_hdr.rle_file = wfile; + +- sv_setup (RUN_DISPATCH, &sv_globals); ++ rle_put_setup (&out_hdr); + + if ((rowvec = (unsigned char **)malloc (planes*sizeof(unsigned char *))) == + (unsigned char **)NULL) +@@ -168,9 +171,9 @@ + for (j = rows - 1; j >= 0; --j) { + for (channel = 0; channel < planes; channel ++) + rowvec[channel] = image->bm + j * rowlen + channel * plnlen; +- sv_putrow (rowvec, cols, &sv_globals); ++ rle_putrow (rowvec, cols, &out_hdr); + } +- sv_puteof (&sv_globals); ++ rle_puteof (&out_hdr); + + free (rowvec); + while (cp > comments) +@@ -203,13 +206,16 @@ + int plnlen; + int mapEntries; + int clearRow; ++ rle_hdr in_hdr; ++ ++ in_hdr = *rle_hdr_init( (rle_hdr *)0 ); + + /* must put the magic number back so the setup code can read it */ + while (mlen--) + (void)ungetc (*mstr++, rfile); + +- sv_globals.svfb_fd = rfile; +- switch (rle_get_setup (&sv_globals)) { ++ in_hdr.rle_file = rfile; ++ switch (rle_get_setup (&in_hdr)) { + case 0: + break; /* success */ + case -1: +@@ -229,34 +235,34 @@ + stderr); + } + +- if (sv_globals.sv_alpha) { ++ if (in_hdr.alpha) { + fputs ("read_rle: discarding alpha channel.\n", stderr); +- SV_CLR_BIT (sv_globals, SV_ALPHA); ++ RLE_CLR_BIT (in_hdr, RLE_ALPHA); + } + +- image->hdr.cols = sv_globals.sv_xmax - sv_globals.sv_xmin + 1; +- image->hdr.rows = rows = sv_globals.sv_ymax - sv_globals.sv_ymin + 1; +- image->hdr.planes = planes = sv_globals.sv_ncolors; +- image->hdr.bits = sv_globals.sv_cmaplen ? sv_globals.sv_cmaplen : 8; ++ image->hdr.cols = in_hdr.xmax - in_hdr.xmin + 1; ++ image->hdr.rows = rows = in_hdr.ymax - in_hdr.ymin + 1; ++ image->hdr.planes = planes = in_hdr.ncolors; ++ image->hdr.bits = in_hdr.cmaplen ? in_hdr.cmaplen : 8; + image->hdr.physbits = 8; + image->hdr.rowlen = rowlen = image->hdr.cols; + image->hdr.plnlen = plnlen = image->hdr.rows * image->hdr.rowlen; + +- image->hdr.clrlen = 1 << sv_globals.sv_cmaplen; +- if ((comment = rle_getcom (CMAP_COMMENT, &sv_globals)) != (char *)NULL) ++ image->hdr.clrlen = 1 << in_hdr.cmaplen; ++ if ((comment = rle_getcom (CMAP_COMMENT, &in_hdr)) != (char *)NULL) + image->hdr.clrlen = atoi (comment); +- image->hdr.clrlen *= sv_globals.sv_ncmap; ++ image->hdr.clrlen *= in_hdr.ncmap; + +- if ((comment = rle_getcom (ASPECT_COMMENT, &sv_globals)) != (char *)NULL) ++ if ((comment = rle_getcom (ASPECT_COMMENT, &in_hdr)) != (char *)NULL) + image->hdr.aspect = atof (comment); + else + image->hdr.aspect = 1.0; + +- if ((comment = rle_getcom (TITLE_COMMENT, &sv_globals)) != (char *)NULL) ++ if ((comment = rle_getcom (TITLE_COMMENT, &in_hdr)) != (char *)NULL) + (void)strcpy (image->hdr.title, comment); + else + image->hdr.title[0] = '\0'; +- if ((comment = rle_getcom (CREDITS_COMMENT, &sv_globals)) != (char *)NULL) ++ if ((comment = rle_getcom (CREDITS_COMMENT, &in_hdr)) != (char *)NULL) + (void)strcpy (image->hdr.credits, comment); + else + image->hdr.credits[0] = '\0'; +@@ -266,9 +272,9 @@ + alloc_fbm (image); + + if (image->hdr.clrlen > 0) { +- mapEntries = (image->hdr.clrlen / sv_globals.sv_ncmap); ++ mapEntries = (image->hdr.clrlen / in_hdr.ncmap); + cp = image->cm; +- colorMap = buildmap (&sv_globals, CMAP_COLORS, 1.0); ++ colorMap = buildmap (&in_hdr, CMAP_COLORS, 1.0, 1.0); + for (channel = 0; channel < CMAP_COLORS; channel++) { + for (j = 0; j < mapEntries; j++) + *cp++ = colorMap[channel][j]; +@@ -278,26 +284,26 @@ + image->hdr.clrlen = mapEntries * CMAP_COLORS; /* renormalize clrlen */ + } + +- switch (sv_globals.sv_background) { ++ switch (in_hdr.background) { + case 0: /* no background color was saved */ + clearRow = TRUE; /* manually clear rows to 0 */ + break; + case 1: /* don't clear to the background color */ +- sv_globals.sv_background = 2; /* force automatic clearing */ ++ in_hdr.background = 2; /* force automatic clearing */ + /* fall through... */ + case 2: /* clear to the background color */ + clearRow = FALSE; + break; + default: + fprintf (stderr, "read_rle: unknown background flag '%d'.\n", +- sv_globals.sv_background); ++ in_hdr.background); + } + + /* move image to origin */ +- sv_globals.sv_xmin = 0; +- sv_globals.sv_xmax = image->hdr.cols - 1; +- sv_globals.sv_ymin = 0; +- sv_globals.sv_ymax = image->hdr.rows - 1; ++ in_hdr.xmin = 0; ++ in_hdr.xmax = image->hdr.cols - 1; ++ in_hdr.ymin = 0; ++ in_hdr.ymax = image->hdr.rows - 1; + + if ((rowvec = (unsigned char **)malloc (planes*sizeof(unsigned char *))) == + (unsigned char **)NULL) +@@ -312,7 +318,7 @@ + if (clearRow) + bzero ((char *)rowvec[channel], rowlen); + } +- rle_getrow (&sv_globals, rowvec); ++ rle_getrow (&in_hdr, rowvec); + } + free (rowvec); + |