X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/blobdiff_plain/59fc927dc9f183802621138534fa6eaafe5593ba..688a56e8ab67b56550e2874d9d7423f0d435bfd9:/wrlib/tests/testrot.c diff --git a/wrlib/tests/testrot.c b/wrlib/tests/testrot.c dissimilarity index 81% index 026e6073..093d0904 100644 --- a/wrlib/tests/testrot.c +++ b/wrlib/tests/testrot.c @@ -1,70 +1,66 @@ - - -#include -#include "wraster.h" -#include -#include -#include -#include "tile.xpm" -Display *dpy; -Window win; -RContext *ctx; -RImage *img; -Pixmap pix; - - -#define MAX(a,b) (a)>(b) ? (a) : (b) - -int main(int argc, char **argv) -{ - RContextAttributes attr; - float a; - - dpy = XOpenDisplay(""); - if (!dpy) { - puts("cant open display"); - exit(1); - } - - attr.flags = RC_RenderMode | RC_ColorsPerChannel; - attr.render_mode = RDitheredRendering; - attr.colors_per_channel = 4; - ctx = RCreateContext(dpy, DefaultScreen(dpy), &attr); - - if (argc<2) - img = RGetImageFromXPMData(ctx, image_name); - else - img = RLoadImage(ctx, argv[1], 0); - - if (!img) { - puts(RMessageForError(RErrorCode)); - exit(1); - } - win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, - MAX(img->width, img->height), - MAX(img->height, img->width), 0, 0, 0); - XMapRaised(dpy, win); - XFlush(dpy); - - a = 0; - while (1) { - RImage *tmp; - - a = a + 1.0; - - tmp = RRotateImage(img, a); - if (!RConvertImage(ctx, tmp, &pix)) { - puts(RMessageForError(RErrorCode)); - exit(1); - } - RReleaseImage(tmp); - - XSetWindowBackgroundPixmap(dpy, win, pix); - XFreePixmap(dpy, pix); - XClearWindow(dpy, win); - XSync(dpy, 0); - usleep(50000); - } - exit(0); -} - + +#include +#include "wraster.h" +#include +#include +#include +#include "tile.xpm" +Display *dpy; +Window win; +RContext *ctx; +RImage *img; +Pixmap pix; + +#define MAX(a,b) (a)>(b) ? (a) : (b) + +int main(int argc, char **argv) +{ + RContextAttributes attr; + float a; + + dpy = XOpenDisplay(""); + if (!dpy) { + puts("cant open display"); + exit(1); + } + + attr.flags = RC_RenderMode | RC_ColorsPerChannel; + attr.render_mode = RDitheredRendering; + attr.colors_per_channel = 4; + ctx = RCreateContext(dpy, DefaultScreen(dpy), &attr); + + if (argc < 2) + img = RGetImageFromXPMData(ctx, image_name); + else + img = RLoadImage(ctx, argv[1], 0); + + if (!img) { + puts(RMessageForError(RErrorCode)); + exit(1); + } + win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, + MAX(img->width, img->height), MAX(img->height, img->width), 0, 0, 0); + XMapRaised(dpy, win); + XFlush(dpy); + + a = 0; + while (1) { + RImage *tmp; + + a = a + 1.0; + + tmp = RRotateImage(img, a); + if (!RConvertImage(ctx, tmp, &pix)) { + puts(RMessageForError(RErrorCode)); + exit(1); + } + RReleaseImage(tmp); + + XSetWindowBackgroundPixmap(dpy, win, pix); + XFreePixmap(dpy, pix); + XClearWindow(dpy, win); + XSync(dpy, 0); + usleep(50000); + } + exit(0); +}