X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fzoom.c;h=8f7364d369279de0556c17b55cd8f32effbf0811;hb=3f438031d610c7e15fd33876a879b97e290e05fb;hp=18a0bda8ae1499715dcb253cf8996332ae31c99f;hpb=ebc241816cc8e3eec7270a594bb1a607df32bcd6;p=xscreensaver diff --git a/hacks/zoom.c b/hacks/zoom.c index 18a0bda8..8f7364d3 100644 --- a/hacks/zoom.c +++ b/hacks/zoom.c @@ -99,20 +99,21 @@ static void init_hack(Display *dpy, Window window) gcflags |= GCSubwindowMode; window_gc = XCreateGC(dpy, window, gcflags, &gcv); - grab_screen_image(xgwa.screen, window); + + orig_map = NULL; + pm = XCreatePixmap(dpy, window, sizex, sizey, xgwa.depth); + load_random_image (xgwa.screen, window, pm, NULL, NULL); + + if (!lenses) { + orig_map = XGetImage(dpy, pm, 0, 0, sizex, sizey, ~0L, ZPixmap); + XFreePixmap(dpy, pm); + pm = 0; + } /* We might have needed this to grab the image, but if we leave this set to GCSubwindowMode, then we'll *draw* right over subwindows too. */ XSetSubwindowMode (dpy, window_gc, ClipByChildren); - if (lenses) { - orig_map = NULL; - pm = XCreatePixmap(dpy, window, sizex, sizey, xgwa.depth); - XCopyArea(dpy, window, pm, window_gc, 0, 0, sizex, sizey, 0, 0); - } else { - orig_map = XGetImage(dpy, window, 0, 0, sizex, sizey, ~0L, ZPixmap); - pm = 0; - } XFillRectangle(dpy, window, window_gc, 0, 0, sizex, sizey); XSetWindowBackground(dpy, window, bg); @@ -137,9 +138,9 @@ static void onestep(Display *dpy, Window window) now = currentTimeInMs(); /* find new x,y */ - tlx = ((1. + sin(((float)now) / X_PERIOD * 2. * M_PI))/2.0) + tlx = ((1. + sin(((double)now) / X_PERIOD * 2. * M_PI))/2.0) * (sizex - s/2) /* -s/4 */ + MINX; - tly = ((1. + sin(((float)now) / Y_PERIOD * 2. * M_PI))/2.0) + tly = ((1. + sin(((double)now) / Y_PERIOD * 2. * M_PI))/2.0) * (sizey - s/2) /* -s/4 */ + MINY; if (lenses) { @@ -186,7 +187,7 @@ XrmOptionDescRec options[] = { { "-pixwidth", ".pixwidth", XrmoptionSepArg, 0 }, { "-pixheight", ".pixheight", XrmoptionSepArg, 0 }, { "-pixspacex", ".pixspacex", XrmoptionSepArg, 0 }, - { "-pixspacey", ".pixspacex", XrmoptionSepArg, 0 }, + { "-pixspacey", ".pixspacey", XrmoptionSepArg, 0 }, { "-lensoffsetx", ".lensoffsetx", XrmoptionSepArg, 0 }, { "-lensoffsety", ".lensoffsety", XrmoptionSepArg, 0 }, { 0, 0, 0, 0 }