From f5fdf166ac7de84146d5e465ab6adcf17daf55f6 Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 25 Feb 2011 17:02:53 +0000 Subject: Convert to use imlib2, based on Debian patches. Set LICENSE. Bump PKGREVISION. --- graphics/magicpoint/Makefile | 6 +- graphics/magicpoint/distinfo | 10 +- graphics/magicpoint/options.mk | 4 +- graphics/magicpoint/patches/patch-aa | 82 +++++++++- graphics/magicpoint/patches/patch-ab | 13 +- graphics/magicpoint/patches/patch-ae | 51 +++++- .../magicpoint/patches/patch-image_imlib__loader.c | 182 +++++++++++++++++++++ .../magicpoint/patches/patch-image_xloadimage.h | 15 ++ 8 files changed, 343 insertions(+), 20 deletions(-) create mode 100644 graphics/magicpoint/patches/patch-image_imlib__loader.c create mode 100644 graphics/magicpoint/patches/patch-image_xloadimage.h (limited to 'graphics') diff --git a/graphics/magicpoint/Makefile b/graphics/magicpoint/Makefile index bb8f3a56211..ab977737cb3 100644 --- a/graphics/magicpoint/Makefile +++ b/graphics/magicpoint/Makefile @@ -1,13 +1,14 @@ -# $NetBSD: Makefile,v 1.69 2011/02/19 10:03:18 markd Exp $ +# $NetBSD: Makefile,v 1.70 2011/02/25 17:02:53 wiz Exp $ DISTNAME= magicpoint-1.13a -PKGREVISION= 5 +PKGREVISION= 6 CATEGORIES= x11 graphics MASTER_SITES= ftp://sh.wide.ad.jp/WIDE/free-ware/mgp/ MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://member.wide.ad.jp/wg/mgp/ COMMENT= X11 based presentation tool +LICENSE= modified-bsd PKG_DESTDIR_SUPPORT= user-destdir @@ -79,4 +80,3 @@ post-install: .include "../../x11/libXext/buildlink3.mk" .include "../../x11/libXmu/buildlink3.mk" .include "../../mk/bsd.pkg.mk" -# DO NOT DELETE diff --git a/graphics/magicpoint/distinfo b/graphics/magicpoint/distinfo index ade669e11fa..9764d665801 100644 --- a/graphics/magicpoint/distinfo +++ b/graphics/magicpoint/distinfo @@ -1,13 +1,13 @@ -$NetBSD: distinfo,v 1.17 2010/12/15 19:08:21 chuck Exp $ +$NetBSD: distinfo,v 1.18 2011/02/25 17:02:53 wiz Exp $ SHA1 (magicpoint-1.13a.tar.gz) = 2bc662ad0a482d42578766258a143b06a4718ae3 RMD160 (magicpoint-1.13a.tar.gz) = 067d7dee3b90ec354975d9ad4ea0c0df48cca191 Size (magicpoint-1.13a.tar.gz) = 890670 bytes -SHA1 (patch-aa) = 7270255c2002c66d10ab911ed22ce67067183e17 -SHA1 (patch-ab) = eb6558d6981e5d5f41f55dddc1b3debc9ca27d36 +SHA1 (patch-aa) = 59bc5a8bce25ac27a77ae8d03dd42f354d1d1bff +SHA1 (patch-ab) = 6622ca95dfcf059d9464f8cc959d23c9c787d8b6 SHA1 (patch-ac) = b886607033a89e3ab46c41a2a5a8368b473682f4 SHA1 (patch-ad) = 33c8fa61cb03cb53ad8783d2d79fa457cb21d235 -SHA1 (patch-ae) = ca59b94955f2de6f19ea1e2210ede7eaeba50a95 +SHA1 (patch-ae) = 49aab80a13d7daf99671c69cf62f432c03054dad SHA1 (patch-af) = 615e845dfbeba9b35c5a138841962631dac3b4bb SHA1 (patch-ag) = 96d7cac9157b9183dd2ba76b12f0927fc15dd5a6 SHA1 (patch-ai) = 809b2cf509bab0ee1bed1fecb2cf2d8df912ce8b @@ -29,3 +29,5 @@ SHA1 (patch-ay) = 4c618b7c51f8b41a472ddd6cba938a2ccb3d91e1 SHA1 (patch-az) = 893ec7e21199205c07933d5525a6eb394114fd11 SHA1 (patch-ba) = 938e5714ddfcb8ca64d1cc6f756eeb69e592905d SHA1 (patch-bb) = 3a6c328adcb49aef0d4792ceff08407fcbc80c16 +SHA1 (patch-image_imlib__loader.c) = 99aa122d4d4f474c448fa2767bee3496ca97110a +SHA1 (patch-image_xloadimage.h) = 05a1caeedca9c33beecffb8f078270d88fc7184c diff --git a/graphics/magicpoint/options.mk b/graphics/magicpoint/options.mk index 0f8ee97ee07..bc31190f179 100644 --- a/graphics/magicpoint/options.mk +++ b/graphics/magicpoint/options.mk @@ -1,4 +1,4 @@ -# $NetBSD: options.mk,v 1.1 2008/09/10 13:32:47 taca Exp $ +# $NetBSD: options.mk,v 1.2 2011/02/25 17:02:53 wiz Exp $ .include "../../mk/bsd.prefs.mk" @@ -37,7 +37,7 @@ MGP_VFONT= % % CONFIGURE_ARGS+= --disable-xft2 .endif -.include "../../graphics/imlib/buildlink3.mk" +.include "../../graphics/imlib2/buildlink3.mk" # diff --git a/graphics/magicpoint/patches/patch-aa b/graphics/magicpoint/patches/patch-aa index 7eb8d22f41a..43f0ab36dfe 100644 --- a/graphics/magicpoint/patches/patch-aa +++ b/graphics/magicpoint/patches/patch-aa @@ -1,7 +1,16 @@ -$NetBSD: patch-aa,v 1.11 2008/09/10 13:32:47 taca Exp $ +$NetBSD: patch-aa,v 1.12 2011/02/25 17:02:53 wiz Exp $ ---- configure.orig 2007-12-29 05:31:26.000000000 +0900 +--- configure.orig 2007-12-28 20:31:26.000000000 +0000 +++ configure +@@ -1285,7 +1285,7 @@ Optional Features: + --enable-freetype-charset16 use freetype for chaset16. + --disable-xft2 DON'T use xft2 libraries. + --enable-gif compile gif support in (need libungif). +- --enable-imlib use imlib exclusively to load images. ++ --enable-imlib use imlib2 exclusively to load images. + + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5090,7 +5090,7 @@ if test "$mgp_use_freetype" = "yes"; the # XXX: freetype2 may use freetype-config { echo "$as_me:$LINENO: checking for freetype1 library/header" >&5 @@ -118,9 +127,9 @@ $NetBSD: patch-aa,v 1.11 2008/09/10 13:32:47 taca Exp $ - LIBS="$LIBS `pkg-config --libs imlib`" - OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`" - cat >>confdefs.h <<\_ACEOF -+ if type pkg-config > /dev/null 2>&1 && pkg-config imlib; then -+ LIBS="$LIBS `pkg-config --libs imlib`" -+ OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`" ++ if type pkg-config > /dev/null 2>&1 && pkg-config imlib2; then ++ LIBS="$LIBS `pkg-config --libs imlib2`" ++ OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib2`" + cat >>confdefs.h <<\_ACEOF #define USE_IMLIB 1 _ACEOF @@ -130,12 +139,71 @@ $NetBSD: patch-aa,v 1.11 2008/09/10 13:32:47 taca Exp $ else { echo "$as_me:$LINENO: checking for Imlib_init in -lImlib" >&5 echo $ECHO_N "checking for Imlib_init in -lImlib... $ECHO_C" >&6; } -@@ -7232,7 +7216,7 @@ fi +@@ -7163,7 +7147,7 @@ if test "${ac_cv_lib_Imlib_Imlib_init+se + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lImlib -L$x_libraries -lX11 -lXext $LIBS" ++LIBS="-lImlib2 -L$x_libraries -lX11 -lXext $LIBS" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ + _ACEOF +@@ -7177,11 +7161,11 @@ cat >>conftest.$ac_ext <<_ACEOF + #ifdef __cplusplus + extern "C" + #endif +-char Imlib_init (); ++char imlib_load_image (); + int + main () + { +-return Imlib_init (); ++return imlib_load_image (); + ; + return 0; + } +@@ -7220,7 +7204,7 @@ fi + echo "${ECHO_T}$ac_cv_lib_Imlib_Imlib_init" >&6; } + if test $ac_cv_lib_Imlib_Imlib_init = yes; then + imlib_ok=yes +- LIBS="$LIBS -lImlib" ++ LIBS="$LIBS -lImlib2" + cat >>confdefs.h <<\_ACEOF + #define USE_IMLIB 1 + _ACEOF +@@ -7232,14 +7216,14 @@ fi echo 'FATAL: You need libImlib to use Imlib loading. pass proper LIBS to configure.' exit 1 fi - for i in /usr/pkg /usr/local; do +- if test -f $i/include/Imlib.h; then + for i in ${BUILDLINK_DIR}; do - if test -f $i/include/Imlib.h; then ++ if test -f $i/include/Imlib2.h; then imlib_h_ok=yes OPTFLAGS="$OPTFLAGS -I$i/include" + break + fi + done +- if test -f /usr/include/Imlib.h; then ++ if test -f /usr/include/Imlib2.h; then + imlib_h_ok=yes + fi + if test "x$gif_h_ok" != "xyes"; then +@@ -7262,7 +7246,7 @@ cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + $ac_includes_default +-#include ++#include + _ACEOF + rm -f conftest.$ac_objext + if { (ac_try="$ac_compile" +@@ -7302,7 +7286,7 @@ _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ +-#include ++#include + _ACEOF + if { (ac_try="$ac_cpp conftest.$ac_ext" + case "(($ac_try" in diff --git a/graphics/magicpoint/patches/patch-ab b/graphics/magicpoint/patches/patch-ab index 9796ca47e7d..73754ba6665 100644 --- a/graphics/magicpoint/patches/patch-ab +++ b/graphics/magicpoint/patches/patch-ab @@ -1,6 +1,6 @@ -$NetBSD: patch-ab,v 1.4 2008/09/10 13:32:47 taca Exp $ +$NetBSD: patch-ab,v 1.5 2011/02/25 17:02:53 wiz Exp $ ---- mgp.h.orig 2008-01-19 02:43:20.000000000 +0900 +--- mgp.h.orig 2008-01-18 17:43:20.000000000 +0000 +++ mgp.h @@ -64,7 +64,9 @@ #ifdef USE_XFT2 @@ -26,6 +26,15 @@ $NetBSD: patch-ab,v 1.4 2008/09/10 13:32:47 taca Exp $ u_int ct_page; struct ctrl *ct_next; union { +@@ -507,7 +515,7 @@ struct render_object { + float xzoom, yzoom; + #ifdef USE_IMLIB + int zoomonclk; +- ImlibImage *imimage; ++ Imlib_Image *imimage; + #endif + } image; + struct { @@ -745,6 +753,11 @@ extern int get_regid __P((char *)); extern void draw_line_itemsize __P((struct render_state *, int, int, int)); extern void draw_line_start __P((struct render_state *)); diff --git a/graphics/magicpoint/patches/patch-ae b/graphics/magicpoint/patches/patch-ae index 8c576694be5..f6a7dfbfa9e 100644 --- a/graphics/magicpoint/patches/patch-ae +++ b/graphics/magicpoint/patches/patch-ae @@ -1,7 +1,54 @@ -$NetBSD: patch-ae,v 1.3 2008/09/10 13:32:47 taca Exp $ +$NetBSD: patch-ae,v 1.4 2011/02/25 17:02:53 wiz Exp $ ---- draw.c.orig 2008-01-25 00:43:17.000000000 +0900 +--- draw.c.orig 2008-01-24 15:43:17.000000000 +0000 +++ draw.c +@@ -31,7 +31,7 @@ + + #include "mgp.h" + #ifdef USE_IMLIB +-#include ++#include + #endif + + /* state associated with the window - how should we treat this? */ +@@ -83,8 +83,8 @@ static int obj_new_xfont __P((struct ren + u_int, char *)); + static int obj_new_image __P((struct render_state *, int, int, Image *, int, int)); + #ifdef USE_IMLIB +-ImlibImage *search_imdata __P((char *)); +-static int obj_new_image2 __P((struct render_state *, int, int, Image *, int, int, ImlibImage *, int)); ++Imlib_Image *search_imdata __P((char *)); ++static int obj_new_image2 __P((struct render_state *, int, int, Image *, int, int, Imlib_Image *, int)); + #endif + static int obj_new_icon __P((struct render_state *, int, int, u_int, u_int, u_long, u_int, XPoint *)); + static Pixel obj_image_color __P((Image *, Image *, Pixel, int *)); +@@ -168,7 +168,7 @@ static void regist_zimage_position __P(( + static void clear_zimage __P((int)); + static void clear_region __P((int, int, int, int)); + #define ZIMAGENUM 100 +-static ImlibImage *zimage[ZIMAGENUM]; ++static Imlib_Image *zimage[ZIMAGENUM]; + static int zonzoom[ZIMAGENUM]; + static int zpage[ZIMAGENUM]; + static int zx[ZIMAGENUM]; +@@ -1819,7 +1819,7 @@ obj_new_image2(state, x, y, image, xzoom + int x, y; + Image *image; + int xzoom, yzoom; +- ImlibImage *imimage; ++ Imlib_Image *imimage; + int zoomonclk; + { + struct render_object *obj; +@@ -3212,7 +3212,7 @@ image_load(state, filename, numcolor, xi + static char backfile[MAXPATHLEN]; + static int backzoom, backnumcolor, backx, backy; + #ifdef USE_IMLIB +- ImlibImage *imimage; ++ Imlib_Image *imimage; + #endif + + if (!caching){ @@ -5243,7 +5243,7 @@ xft_draw_fragment(state, p, len, registr static char prefix[3][20] = { "\033$B", "\033$A", "\033$(C"}; char buf16[1024], *p16; diff --git a/graphics/magicpoint/patches/patch-image_imlib__loader.c b/graphics/magicpoint/patches/patch-image_imlib__loader.c new file mode 100644 index 00000000000..ff29847738c --- /dev/null +++ b/graphics/magicpoint/patches/patch-image_imlib__loader.c @@ -0,0 +1,182 @@ +$NetBSD: patch-image_imlib__loader.c,v 1.1 2011/02/25 17:02:53 wiz Exp $ + +imlib2 patch from suse. + +--- image/imlib_loader.c.orig 2008-01-16 14:52:14.000000000 +0000 ++++ image/imlib_loader.c +@@ -6,13 +6,14 @@ + #include + #include + #include +-#include ++#include + + #define IMFILENUM 500 + static char imfile[IMFILENUM][1024]; +-static ImlibImage *imdata[IMFILENUM]; ++static Imlib_Image *imdata[IMFILENUM]; ++static Image *imagedata[IMFILENUM]; + static int imnum; +-static ImlibData *id; ++static Imlib_Context *id; + + int imIdent(char *fullname, char *name) + { +@@ -22,32 +23,71 @@ int imIdent(char *fullname, char *name) + Image *imLoad(char *fullname, char *name, unsigned int verbose) + { + static Display *disp = NULL; +- Image *image; +- ImlibImage *im; +- ImlibColor shape; +- unsigned int w,h, size; +- ImlibImage *search_imdata(); ++ Image *image = NULL; ++ Imlib_Image *im; ++ unsigned int w,h, size, i; ++ DATA32 * argb_data; ++ byte * rgb_ptr; ++ Imlib_Image *search_imdata(); + void regist_imdata(); + + if (disp == NULL) { + disp=XOpenDisplay(NULL); + } +- if (id == NULL) id=Imlib_init(disp); +- if ((im = search_imdata(fullname)) == NULL) { +- im = Imlib_load_image(id, fullname); ++ /* if (id == NULL) id=Imlib_init(disp); */ ++ /* might needs more work */ ++ if (id == NULL) { ++ /* dither for non-truecolor displays */ ++ imlib_context_set_dither(1); ++ imlib_context_set_display(disp); ++ imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp))); ++ imlib_context_set_colormap(DefaultColormap(disp, DefaultScreen(disp))); ++ } ++ if ((im = search_imdata(fullname), image) == NULL) { ++ /* im = Imlib_load_image(id, fullname); */ ++ im = imlib_load_image(fullname); + } + if (im == NULL) { + return NULL; + } +- w = im->rgb_width; +- h = im->rgb_height; +- size = w * h * 3; +- +- image = newTrueImage(w, h); +- memcpy(image->data, im->rgb_data, size); +- +- Imlib_get_image_shape(id, im, &shape); +- ++ imlib_context_set_image(im); ++ w = imlib_image_get_width(); ++ h = imlib_image_get_height(); ++ size = w * h; ++ ++ if (image == NULL) image = newTrueImage(w, h); ++ ++ /* Imlib2 stores images in ARGB format (32 bpp). MagicPoint ++ * wants RGB data (24 bpp). So we need a conversion pass. */ ++ argb_data = imlib_image_get_data_for_reading_only(); ++ rgb_ptr = image->data; ++ for (i = 0; i < size; ++i) ++ { ++ if ((argb_data[i] >> 24) < 128) ++ { ++ /* If this is a transparent pixel, we store #FE00FE. */ ++ *rgb_ptr++ = 0xFE; ++ *rgb_ptr++ = 0x00; ++ *rgb_ptr++ = 0xFE; ++ /* Tell mgp we have transparent pixels. */ ++ image->trans = 0xFE00FE; ++ } ++ else if ((argb_data[i] & 0x00FFFFFF) == 0x00FE00FE) ++ { ++ /* If that color is actually used, we substitute something close. */ ++ *rgb_ptr++ = 0xFF; ++ *rgb_ptr++ = 0x00; ++ *rgb_ptr++ = 0xFE; ++ } ++ else ++ { ++ /* Otherwise, we can copy the pixel. */ ++ *rgb_ptr++ = (argb_data[i] >> 16) & 0xFF; /* red */ ++ *rgb_ptr++ = (argb_data[i] >> 8) & 0xFF; /* green */ ++ *rgb_ptr++ = argb_data[i] & 0xFF; /* blue */ ++ } ++ } ++#if 0 + /* + * bug fix for transparent gif handling + * suggested by Jose Geraldo Alves Brito Neto +@@ -57,44 +97,52 @@ Image *imLoad(char *fullname, char *name + ((shape.r & 0xff) << 16) | + ((shape.g & 0xff) << 8) | + ((shape.b & 0xff) << 0); ++#endif + + image->title = dupString(name); + #if 0 + Imlib_kill_image(id, im); + #else +- regist_imdata(name, im); ++ regist_imdata(name, im, image); + #endif + + return image; + } + +-ImlibImage *search_imdata(char *fullname) ++Imlib_Image *search_imdata(char *fullname, Image *image) + { + int i; + for (i = 0; i < imnum; i ++){ + if (!strcmp(imfile[i], fullname)) { ++ image = imagedata[i]; + return imdata[i]; + } + } + return NULL; + } + +-void regist_imdata(fullname, im) ++void regist_imdata(fullname, im, image) + char *fullname; +- ImlibImage *im; ++ Imlib_Image *im; ++ Image *image; + { + strcpy(imfile[imnum], fullname); + imdata[imnum] = im; ++ imagedata[imnum] = image; + imnum ++; + } + + Pixmap pixmap_fromimimage(imimage, width, height) +- ImlibImage *imimage; ++ Imlib_Image *imimage; + int width, height; + { + static Pixmap pixmap; ++#if 0 + Imlib_render(id, imimage, width, height); + pixmap = Imlib_move_image(id, imimage); ++#else ++ imlib_render_pixmaps_for_whole_image_at_size(&pixmap, NULL, width, height); ++#endif + + return pixmap; + } +@@ -125,8 +173,8 @@ manage_pixmap(pixmap, add, page) + ppage[i] = page; + } else { + for (i = 0; i < MAXPMAP; i ++) { +- if (ppage[i] == page){ +- Imlib_free_pixmap(id, pmap[i]); ++ if (ppage[i] == page && pmap[i] != 0){ ++ imlib_free_pixmap_and_mask(pmap[i]); + pmap[i] = 0; + } + } diff --git a/graphics/magicpoint/patches/patch-image_xloadimage.h b/graphics/magicpoint/patches/patch-image_xloadimage.h new file mode 100644 index 00000000000..c2f82af18ce --- /dev/null +++ b/graphics/magicpoint/patches/patch-image_xloadimage.h @@ -0,0 +1,15 @@ +$NetBSD: patch-image_xloadimage.h,v 1.1 2011/02/25 17:02:53 wiz Exp $ + +imlib2 patch from suse. + +--- image/xloadimage.h.orig 2007-12-28 20:31:26.000000000 +0000 ++++ image/xloadimage.h +@@ -16,7 +16,7 @@ + #include "options.h" + + #ifdef USE_IMLIB +-#include ++#include + #endif + + /* image name and option structure used when processing arguments -- cgit v1.2.3