X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fxmatrix.c;h=016ec771f225f2075e1a0565e16be6275d15a44a;hp=1a6bebf158c8b857a436e5298e4e20abd6d1ad41;hb=a94197e76a5dea5cb60542840809d6c20d0abbf3;hpb=8eb2873d7054e705c4e83f22d18c40946a9e2529 diff --git a/hacks/xmatrix.c b/hacks/xmatrix.c index 1a6bebf1..016ec771 100644 --- a/hacks/xmatrix.c +++ b/hacks/xmatrix.c @@ -42,11 +42,11 @@ */ #include "screenhack.h" +#include "xpm-pixmap.h" #include #include -#ifdef HAVE_XPM -# include +#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) # include "images/matrix0.xpm" # include "images/matrix1.xpm" # include "images/matrix2.xpm" @@ -144,47 +144,21 @@ typedef struct { static void load_images_1 (m_state *state, int which) { -#ifdef HAVE_XPM +#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_XPM) if (!get_boolean_resource ("mono", "Boolean") && state->xgwa.depth > 1) { - - - XpmAttributes xpmattrs; - int result; - xpmattrs.valuemask = 0; - -# ifdef XpmCloseness - xpmattrs.valuemask |= XpmCloseness; - xpmattrs.closeness = 40000; -# endif -# ifdef XpmVisual - xpmattrs.valuemask |= XpmVisual; - xpmattrs.visual = state->xgwa.visual; -# endif -# ifdef XpmDepth - xpmattrs.valuemask |= XpmDepth; - xpmattrs.depth = state->xgwa.depth; -# endif -# ifdef XpmColormap - xpmattrs.valuemask |= XpmColormap; - xpmattrs.colormap = state->xgwa.colormap; -# endif - - result = XpmCreatePixmapFromData (state->dpy, state->window, - (which == 0 ? (state->small_p ? matrix0b_xpm : matrix0_xpm) : - which == 1 ? (state->small_p ? matrix1b_xpm : matrix1_xpm) : - (state->small_p ? matrix2b_xpm : matrix2_xpm)), - &state->images[which], 0 /* mask */, - &xpmattrs); - if (!state->images || (result != XpmSuccess && result != XpmColorError)) - state->images[which] = 0; - - state->image_width = xpmattrs.width; - state->image_height = xpmattrs.height; + char **bits = + (which == 0 ? (state->small_p ? matrix0b_xpm : matrix0_xpm) : + which == 1 ? (state->small_p ? matrix1b_xpm : matrix1_xpm) : + (state->small_p ? matrix2b_xpm : matrix2_xpm)); + + state->images[which] = + xpm_data_to_pixmap (state->dpy, state->window, bits, + &state->image_width, &state->image_height, 0); } else -#endif /* !HAVE_XPM */ +#endif /* !HAVE_XPM && !HAVE_GDK_PIXBUF */ { unsigned long fg, bg; state->image_width = (state->small_p ? matrix0b_width :matrix0_width);