X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fwebcollage-cocoa.m;h=0b621c8c3c5f1cd8caff3ffedfa649357f474004;hp=d6505df2f5f7cda72df903a218dd618fb78d5304;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hpb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e diff --git a/hacks/webcollage-cocoa.m b/hacks/webcollage-cocoa.m index d6505df2..0b621c8c 100644 --- a/hacks/webcollage-cocoa.m +++ b/hacks/webcollage-cocoa.m @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2006-2011 Jamie Zawinski +/* xscreensaver, Copyright (c) 2006-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 @@ -80,7 +80,7 @@ input_available_p (int fd) static void -display_image (state *st, const char *file) +display_image (Display *dpy, Window window, state *st, const char *file) { NSImage *image = [[NSImage alloc] initWithContentsOfFile: @@ -92,10 +92,14 @@ display_image (state *st, const char *file) return; } - [image drawAtPoint: NSMakePoint (0, 0) - fromRect: NSMakeRect (0, 0, [image size].width, [image size].height) - operation: NSCompositeCopy - fraction: 1.0]; + CGFloat w = [image size].width; + CGFloat h = [image size].height; + if (w <= 1 || h <= 1) { + fprintf (stderr, "webcollage: unparsable image \"%s\"\n", file); + return; + } + + jwxyz_draw_NSImage_or_CGImage (dpy, window, True, image, 0, 0); [image release]; } @@ -298,7 +302,7 @@ webcollage_draw (Display *dpy, Window window, void *closure) const char *target = "COCOA LOAD "; if (!strncmp (target, buf, strlen(target))) { const char *file = buf + strlen(target); - display_image (st, file); + display_image (dpy, window, st, file); } return st->delay;