X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fminixpm.c;h=13a8ab3ce6cda1a866e3136726e424ae7819daed;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=247eca89efc723ac05c7455e855ffaab1a91c317;hpb=ec8d2b32b63649e6d32bdfb306eda062769af823;p=xscreensaver diff --git a/utils/minixpm.c b/utils/minixpm.c index 247eca89..13a8ab3c 100644 --- a/utils/minixpm.c +++ b/utils/minixpm.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2001-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 2001-2014 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -121,6 +121,16 @@ minixpm_to_ximage (Display *dpy, Visual *visual, Colormap colormap, int depth, r = g = b = -1; line += 4; } + else if (!strncasecmp(line, "white", 5)) + { + r = g = b = 255; + line += 5; + } + else if (!strncasecmp(line, "black", 5)) + { + r = g = b = 0; + line += 5; + } else { if (*line != '#') { @@ -190,17 +200,23 @@ minixpm_to_ximage (Display *dpy, Visual *visual, Colormap colormap, int depth, ximage = XCreateImage (dpy, visual, depth, (depth == 1 ? XYBitmap : ZPixmap), 0, 0, w, h, 8, 0); - if (! ximage) return 0; + if (! ximage) + { + if (pixels) free (pixels); + return 0; + } ximage->bitmap_bit_order = ximage->byte_order = (bigendian() ? MSBFirst : LSBFirst); ximage->data = (char *) calloc (ximage->height, ximage->bytes_per_line); - if (!ximage->data) { - XDestroyImage (ximage); - return 0; - } + if (!ximage->data) + { + XDestroyImage (ximage); + if (pixels) free (pixels); + return 0; + } w8 = (w + 7) / 8; if (mask_ret)