[Commit] xrtest xrknockout.c,1.6,1.7 xrtest.c,1.7,1.8
Carl Worth
commit@keithp.com
Mon, 12 May 2003 09:49:08 -0700
- Previous message: [Commit] Xr/src Xr.h,1.23,1.24 xr.c,1.21,1.22 xrgstate.c,1.31,1.32 xrint.h,1.37,1.38
- Next message: [Commit] xrtest xrknockout.c,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: cworth
Update of /local/src/CVS/xrtest
In directory home.keithp.com:/tmp/cvs-serv14183
Modified Files:
xrknockout.c xrtest.c
Log Message:
xrknockout now uses XrSetPattern
Index: xrknockout.c
===================================================================
RCS file: /local/src/CVS/xrtest/xrknockout.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xrknockout.c 23 Apr 2003 15:37:44 -0000 1.6
+++ xrknockout.c 12 May 2003 16:49:06 -0000 1.7
@@ -82,25 +82,47 @@
int x, int y,
int width, int height)
{
- int i, j;
+ XrSurface *check;
XrSave (r);
#define CHECK_SIZE 32
- XrSetRGBColor (r, 0.4, 0.4, 0.4);
+ check = XrSurfaceCreateNextTo (XrGetTargetSurface (r),
+ XrFormatRGB24,
+ 2 * CHECK_SIZE, 2 * CHECK_SIZE);
+ XrSurfaceSetRepeat (check, 1);
+
+ /* Draw the check */
+ {
+ XrSave (r);
+
+ XrSetTargetSurface (r, check);
+
+ XrSetOperator (r, XrOperatorSrc);
+
+ XrSetRGBColor (r, 0.4, 0.4, 0.4);
+
+ rect_path (r, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
+ XrFill (r);
+
+ XrSetRGBColor (r, 0.7, 0.7, 0.7);
+
+ rect_path (r, x, y, CHECK_SIZE, CHECK_SIZE);
+ XrFill (r);
+ rect_path (r, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
+ XrFill (r);
+
+ XrRestore (r);
+ }
+
+ /* Fill the whole surface with the check */
+ XrSetPattern (r, check);
rect_path (r, 0, 0, width, height);
XrFill (r);
- XrSetRGBColor (r, 0.7, 0.7, 0.7);
-
- for (i = 0; i < width; i += CHECK_SIZE)
- for (j = 0; j < height; j += CHECK_SIZE)
- if ((i / CHECK_SIZE + j / CHECK_SIZE) % 2 == 0) {
- rect_path (r, x + i, y + j, CHECK_SIZE, CHECK_SIZE);
- XrFill (r);
- }
+ XrSurfaceDestroy (check);
XrRestore (r);
}
Index: xrtest.c
===================================================================
RCS file: /local/src/CVS/xrtest/xrtest.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xrtest.c 17 Apr 2003 20:41:17 -0000 1.7
+++ xrtest.c 12 May 2003 16:49:06 -0000 1.8
@@ -202,14 +202,17 @@
xrs = XrCreate();
XrSetTargetDrawable (xrs, dpy, drawable);
+ XrSetRGBColor(xrs, 1, 1, 1);
- XrScale(xrs, 5, 5);
/*
+ XrScale(xrs, 5, 5);
+ inf(xrs);
+ XrTranslate(xrs, 0, 2 * SIZE);
inf(xrs);
+ XrTranslate(xrs, 0, - 2 * SIZE);
XrClip(xrs);
-*/
- XrNewPath(xrs);
XrScale(xrs, 1/5.0, 1/5.0);
+*/
/* This is handy for examining problems more closely */
/* XrScale(xrs, 8, 8); */
@@ -218,7 +221,6 @@
XrScale(xrs, 2, -2);
XrTranslate(xrs, 0, -200);
#endif
- XrSetRGBColor(xrs, 1, 1, 1);
XrSetLineWidth(xrs, SIZE / 4);
XrSetTolerance(xrs, .1);
@@ -315,7 +317,10 @@
break;
case Expose:
{
- win_draw(win);
+ XExposeEvent *eev = &xev.xexpose;
+
+ if (eev->count == 0)
+ win_draw(win);
}
break;
}
- Previous message: [Commit] Xr/src Xr.h,1.23,1.24 xr.c,1.21,1.22 xrgstate.c,1.31,1.32 xrint.h,1.37,1.38
- Next message: [Commit] xrtest xrknockout.c,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]