-/* xscreensaver, Copyright (c) 2001-2006 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 2001-2014 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_COCOA
+#ifdef HAVE_JWXYZ
# include "jwxyz.h"
-#else /* !HAVE_COCOA - real Xlib */
+#else /* real Xlib */
# include <X11/Xlib.h>
# include <X11/Xutil.h>
-#endif /* !HAVE_COCOA */
+#endif /* !HAVE_JWXYZ */
#include "minixpm.h"
unsigned long *pixels;
XImage *ximage = 0;
+
+ memset (cmap, 0, sizeof(cmap)); /* avoid warnings */
if (4 != sscanf ((const char *) *data,
"%d %d %d %d %c", &w, &h, &ncolors, &nbytes, &c)) {
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 != '#') {
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)