home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
x
/
x11p-13.zip
/
RCS
/
do_copyarea.c,
< prev
next >
Wrap
Text File
|
1989-12-13
|
23KB
|
1,150 lines
head 2.9;
access ;
symbols pre-merge:2.0;
locks ; strict;
comment @ * @;
2.9
date 89.12.13.19.11.30; author joel; state Exp;
branches ;
next 2.8;
2.8
date 89.12.07.16.34.01; author joel; state Exp;
branches ;
next 2.7;
2.7
date 89.09.28.15.16.32; author joel; state Exp;
branches ;
next 2.6;
2.6
date 89.05.17.11.07.29; author joel; state Exp;
branches ;
next 2.5;
2.5
date 89.05.11.16.44.11; author joel; state Exp;
branches ;
next 2.4;
2.4
date 89.05.08.18.31.37; author joel; state Exp;
branches ;
next 2.3;
2.3
date 89.05.04.14.19.33; author joel; state Exp;
branches ;
next 2.2;
2.2
date 89.05.04.13.42.13; author joel; state Exp;
branches ;
next 2.1;
2.1
date 89.05.03.14.17.26; author joel; state Exp;
branches ;
next 2.0;
2.0
date 89.01.31.17.03.13; author erik; state Exp;
branches ;
next 1.2;
1.2
date 89.01.31.17.03.13; author joel; state Exp;
branches ;
next 1.1;
1.1
date 88.08.15.16.38.09; author susan; state Exp;
branches ;
next ;
desc
@Random copyarea test. Does random 200x200 squares
@
2.9
log
@Added all manner of copyarea tween pixmaps and windows
@
text
@/*****************************************************************************
Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************************/
#include "x11perf.h"
#define NUMPOINTS 100
static Pixmap pix;
static XImage *image;
static XPoint points[NUMPOINTS];
static XSegment *segsa, *segsb;
#define NegMod(x, y) ((y) - (((-x)-1) % (7)) - 1)
int InitScroll(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i;
for (i = 0; i != NUMPOINTS; i++) {
points[i].x = rand() % WIDTH;
points[i].y = rand() % HEIGHT;
}
XDrawLines(xp->d, xp->w, xp->fggc, points, NUMPOINTS, CoordModeOrigin);
return reps;
}
void DoScroll(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i, size, x, y, xorg, yorg;
size = p->special;
xorg = 0; yorg = 0;
x = 0; y = 0;
for (i = 0; i != reps; i++) {
XCopyArea(xp->d, xp->w, xp->w, xp->fggc, x, y+1, size, size, x, y);
y += size;
if (y + size + 1 > HEIGHT) {
yorg++;
if (yorg >= size || yorg + size + 1 > HEIGHT) {
yorg = 0;
xorg++;
if (xorg >= size || xorg + size > WIDTH) {
xorg = 0;
}
}
y = yorg;
x += size;
if (x + size > WIDTH) {
x = xorg;
}
}
}
}
void MidScroll(xp, p)
XParms xp;
Parms p;
{
XClearWindow(xp->d, xp->w);
XDrawLines(xp->d, xp->w, xp->fggc, points, NUMPOINTS, CoordModeOrigin);
}
void EndScroll(xp, p)
XParms xp;
Parms p;
{
}
static void InitCopyLocations(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int x1, y1, x2, y2, size, i;
int xinc, yinc;
int width, height;
/* Try to exercise all alignments of src and destination equally, as well
as all 4 top-to-bottom/bottom-to-top, left-to-right, right-to-left
copying directions. Computation done here just to make sure slow
machines aren't measuring anything but the XCopyArea calls.
*/
size = p->special;
xinc = (size & ~3) + 1;
yinc = xinc + 3;
width = (WIDTH - size) & ~31;
height = (HEIGHT - size) & ~31;
x1 = 0;
y1 = 0;
x2 = width;
y2 = height;
segsa = (XSegment *)malloc(reps * sizeof(XSegment));
segsb = (XSegment *)malloc(reps * sizeof(XSegment));
for (i = 0; i != reps; i++) {
segsa[i].x1 = x1;
segsa[i].y1 = y1;
segsa[i].x2 = x2;
segsa[i].y2 = y2;
/* Move x2, y2, location backward */
x2 -= xinc;
if (x2 < 0) {
x2 = NegMod(x2, width);
y2 -= yinc;
if (y2 < 0) {
y2 = NegMod(y2, height);
}
}
segsb[i].x1 = x1;
segsb[i].y1 = y1;
segsb[i].x2 = x2;
segsb[i].y2 = y2;
/* Move x1, y1 location forward */
x1 += xinc;
if (x1 > width) {
x1 %= 32;
y1 += yinc;
if (y1 > height) {
y1 %= 32;
}
}
} /* end for */
}
int InitCopyWin(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
(void) InitScroll(xp, p, reps);
InitCopyLocations(xp, p, reps);
return reps;
}
int InitCopyPix(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
(void) InitCopyWin(xp, p, reps);
/* Create pixmap to write stuff into, and initialize it */
pix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT,
DefaultDepth(xp->d, DefaultScreen(xp->d)));
XCopyArea(xp->d, xp->w, pix, xp->fggc, 0, 0, WIDTH, HEIGHT, 0, 0);
return reps;
}
Bool InitGetImage(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
(void) InitCopyWin(xp, p, reps);
/* Create image to stuff bits into */
image = XGetImage(xp->d, xp->w, 0, 0, WIDTH, HEIGHT, ~0, ZPixmap);
return reps;
}
Bool InitPutImage(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
(void) InitGetImage(xp, p, reps);
XClearWindow(xp->d, xp->w);
return reps;
}
static void CopyArea(xp, p, reps, src, dst)
XParms xp;
Parms p;
int reps;
Drawable src, dst;
{
int i, size;
XSegment *sa, *sb;
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XCopyArea(xp->d, src, dst, xp->fggc,
sa->x1, sa->y1, size, size, sa->x2, sa->y2);
XCopyArea(xp->d, src, dst, xp->fggc,
sa->x2, sa->y2, size, size, sa->x1, sa->y1);
XCopyArea(xp->d, src, dst, xp->fggc,
sb->x2, sb->y2, size, size, sb->x1, sb->y1);
XCopyArea(xp->d, src, dst, xp->fggc,
sb->x1, sb->y1, size, size, sb->x2, sb->y2);
}
}
void DoCopyWinWin(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
CopyArea(xp, p, reps, xp->w, xp->w);
}
void DoCopyPixWin(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
CopyArea(xp, p, reps, pix, xp->w);
}
void DoCopyWinPix(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
CopyArea(xp, p, reps, xp->w, pix);
}
void DoCopyPixPix(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
CopyArea(xp, p, reps, pix, pix);
}
void DoGetImage(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i, size;
XSegment *sa, *sb;
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XDestroyImage(image);
image = XGetImage(xp->d, xp->w, sa->x1, sa->y1, size, size,
~0, ZPixmap);
XDestroyImage(image);
image = XGetImage(xp->d, xp->w, sa->x2, sa->y2, size, size,
~0, ZPixmap);
XDestroyImage(image);
image = XGetImage(xp->d, xp->w, sb->x2, sb->y2, size, size,
~0, ZPixmap);
XDestroyImage(image);
image = XGetImage(xp->d, xp->w, sb->x1, sb->y1, size, size,
~0, ZPixmap);
/*
One might expect XGetSubImage to be slightly faster than XGetImage. Go look
at the code in Xlib. MIT X11R3 ran approximately 30 times slower for a 500x500
rectangle.
(void) XGetSubImage(xp->d, xp->w, sa->x1, sa->y1, size, size,
~0, ZPixmap, image, sa->x2, sa->y2);
(void) XGetSubImage(xp->d, xp->w, sa->x2, sa->y2, size, size,
~0, ZPixmap, image, sa->x1, sa->y1);
(void) XGetSubImage(xp->d, xp->w, sb->x2, sb->y2, size, size,
~0, ZPixmap, image, sb->x2, sb->y2);
(void) XGetSubImage(xp->d, xp->w, sb->x1, sb->y1, size, size,
~0, ZPixmap, image, sb->x2, sb->y2);
*/
}
}
void DoPutImage(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i, size;
XSegment *sa, *sb;
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XPutImage(xp->d, xp->w, xp->fggc, image,
sa->x1, sa->y1, sa->x2, sa->y2, size, size);
XPutImage(xp->d, xp->w, xp->fggc, image,
sa->x2, sa->y2, sa->x1, sa->y1, size, size);
XPutImage(xp->d, xp->w, xp->fggc, image,
sb->x2, sb->y2, sb->x2, sb->y2, size, size);
XPutImage(xp->d, xp->w, xp->fggc, image,
sb->x1, sb->y1, sb->x2, sb->y2, size, size);
}
}
#ifdef MITSHM
/* ||| This is included to measure the experimental MIT shared memory interface.
There are no guarantees that this interface will remain unchanged, but
then you know that if you'd turned on MITSHM anyway.
*/
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
static XImage shm_image;
static XShmSegmentInfo shminfo;
int InitShmPutImage (xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int image_size;
(void) InitGetImage(xp, p);
XClearWindow(xp->d, xp->w);
shm_image = *image;
image_size = image->bytes_per_line * image->height;
shminfo.shmid = shmget(IPC_PRIVATE, image_size, IPC_CREAT|0777);
if (shminfo.shmid < 0)
{
perror ("shmget");
return False;
}
shminfo.shmaddr = (char *) shmat(shminfo.shmid, 0, 0);
if (shminfo.shmaddr == ((char *) -1))
{
perror ("shmat");
return False;
}
shminfo.readOnly = True;
XShmAttach (xp->d, &shminfo);
shm_image.data = shminfo.shmaddr;
bcopy (image->data, shm_image.data, image_size);
shm_image.obdata = (char *) &shminfo;
return reps;
}
void DoShmPutImage(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i, size;
XSegment *sa, *sb;
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image,
sa->x1, sa->y1, sa->x2, sa->y2, size, size, False);
XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image,
sa->x2, sa->y2, sa->x1, sa->y1, size, size, False);
XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image,
sb->x2, sb->y2, sb->x2, sb->y2, size, size, False);
XShmPutImage(xp->d, xp->w, xp->fggc, &shm_image,
sb->x1, sb->y1, sb->x2, sb->y2, size, size, False);
}
}
void EndShmPutImage(xp, p)
XParms xp;
Parms p;
{
void EndGetImage();
EndGetImage (xp, p);
shmdt (shminfo.shmaddr);
shmctl (shminfo.shmid, IPC_RMID, 0);
}
#endif
void MidCopyPix(xp, p)
XParms xp;
Parms p;
{
XClearWindow(xp->d, xp->w);
}
void EndCopyWin(xp, p)
XParms xp;
Parms p;
{
EndScroll(xp, p);
free(segsa);
free(segsb);
}
void EndCopyPix(xp, p)
XParms xp;
Parms p;
{
EndCopyWin(xp, p);
XFreePixmap(xp->d, pix);
}
void EndGetImage(xp, p)
XParms xp;
Parms p;
{
EndCopyWin(xp, p);
XDestroyImage(image);
}
Bool InitCopyPlane(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i;
XGCValues gcv;
GC pixgc;
for (i = 0; i != NUMPOINTS; i++) {
points[i].x = rand() % WIDTH;
points[i].y = rand() % HEIGHT;
}
InitCopyLocations(xp, p, reps);
/* Create bitmap to write stuff into, and initialize it */
pix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT, 1);
gcv.graphics_exposures = False;
gcv.foreground = 0;
gcv.background = 1;
pixgc = XCreateGC(xp->d, pix,
GCForeground | GCBackground | GCGraphicsExposures, &gcv);
XFillRectangle(xp->d, pix, pixgc, 0, 0, WIDTH, HEIGHT);
gcv.foreground = 1;
gcv.background = 0;
XChangeGC(xp->d, pixgc, GCForeground | GCBackground, &gcv);
XDrawLines(xp->d, pix, pixgc, points, NUMPOINTS, CoordModeOrigin);
XFreeGC(xp->d, pixgc);
return reps;
}
void DoCopyPlane(xp, p, reps)
XParms xp;
Parms p;
int reps;
{
int i, size;
XSegment *sa, *sb;
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XCopyPlane(xp->d, pix, xp->w, xp->fggc,
sa->x1, sa->y1, size, size, sa->x2, sa->y2, 1);
XCopyPlane(xp->d, pix, xp->w, xp->fggc,
sa->x2, sa->y2, size, size, sa->x1, sa->y1, 1);
XCopyPlane(xp->d, pix, xp->w, xp->fggc,
sb->x2, sb->y2, size, size, sb->x1, sb->y1, 1);
XCopyPlane(xp->d, pix, xp->w, xp->fggc,
sb->x1, sb->y1, size, size, sb->x2, sb->y2, 1);
}
}
@
2.8
log
@Changed interface to p->reps
@
text
@d96 1
a96 1
void InitCopyLocations(xp, p, reps)
d158 1
a158 1
int InitCopyArea(xp, p, reps)
d173 1
a173 1
(void) InitCopyArea(xp, p, reps);
a178 1
XClearWindow(xp->d, xp->w);
d187 1
a187 1
(void) InitCopyArea(xp, p, reps);
d204 1
a204 1
void DoCopyArea(xp, p, reps)
d208 1
d215 1
a215 1
XCopyArea(xp->d, xp->w, xp->w, xp->fggc,
d217 1
a217 1
XCopyArea(xp->d, xp->w, xp->w, xp->fggc,
d219 1
a219 1
XCopyArea(xp->d, xp->w, xp->w, xp->fggc,
d221 1
a221 1
XCopyArea(xp->d, xp->w, xp->w, xp->fggc,
d226 1
a226 1
void DoCopyPix(xp, p, reps)
d231 2
a232 2
int i, size;
XSegment *sa, *sb;
d234 6
a239 11
size = p->special;
for (sa = segsa, sb = segsb, i = 0; i != reps; i++, sa++, sb++) {
XCopyArea(xp->d, pix, xp->w, xp->fggc,
sa->x1, sa->y1, size, size, sa->x2, sa->y2);
XCopyArea(xp->d, pix, xp->w, xp->fggc,
sa->x2, sa->y2, size, size, sa->x1, sa->y1);
XCopyArea(xp->d, pix, xp->w, xp->fggc,
sb->x2, sb->y2, size, size, sb->x1, sb->y1);
XCopyArea(xp->d, pix, xp->w, xp->fggc,
sb->x1, sb->y1, size, size, sb->x2, sb->y2);
}
d242 16
d407 1
a407 1
void EndCopyArea(xp, p)
d420 1
a420 1
EndCopyArea(xp, p);
d428 1
a428 1
EndCopyArea(xp, p);
@
2.7
log
@Added MIT shared-memory benchmarks
@
text
@d35 1
a35 1
Bool InitScrolling(xp, p)
d38 1
d47 1
a47 1
return True;
d50 1
a50 1
void DoScrolling(xp, p)
d53 1
d61 1
a61 1
for (i = 0; i != p->reps; i++) {
d90 1
a90 1
void EndScrolling(xp, p)
d96 1
a96 1
void InitCopyLocations(xp, p)
d99 1
d122 3
a124 3
segsa = (XSegment *)malloc((p->reps) * sizeof(XSegment));
segsb = (XSegment *)malloc((p->reps) * sizeof(XSegment));
for (i = 0; i != p->reps; i++) {
d158 1
a158 1
Bool InitCopyArea(xp, p)
d161 1
d163 3
a165 3
(void) InitScrolling(xp, p);
InitCopyLocations(xp, p);
return True;
d168 1
a168 1
Bool InitCopyPix(xp, p)
d171 1
d173 1
a173 1
(void) InitCopyArea(xp, p);
d180 1
a180 1
return True;
d183 1
a183 1
Bool InitGetImage(xp, p)
d186 1
d188 1
a188 1
(void) InitCopyArea(xp, p);
d192 1
a192 1
return True;
d195 1
a195 1
Bool InitPutImage(xp, p)
d198 1
d200 1
a200 1
(void) InitGetImage(xp, p);
d202 1
a202 1
return True;
d205 1
a205 1
void DoCopyArea(xp, p)
d208 1
d214 1
a214 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
d226 1
a226 1
void DoCopyPix(xp, p)
d229 1
d235 1
a235 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
d247 1
a247 1
void DoGetImage(xp, p)
d250 1
d256 1
a256 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
d287 1
a287 1
void DoPutImage(xp, p)
d290 1
d296 1
a296 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
d323 1
a323 1
Bool InitShmPutImage (xp, p)
d326 1
d351 1
a351 1
return True;
d354 1
a354 1
void DoShmPutImage(xp, p)
d357 1
d363 1
a363 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
d400 1
a400 1
EndScrolling(xp, p);
d421 1
a421 1
Bool InitCopyPlane(xp, p)
d424 1
d434 1
a434 1
InitCopyLocations(xp, p);
d450 1
a450 1
return True;
d453 1
a453 1
void DoCopyPlane(xp, p)
d456 1
d462 1
a462 1
for (sa = segsa, sb = segsb, i = 0; i != p->reps; i++, sa++, sb++) {
@
2.6
log
@Fixed gcs to turn of graphics_exposures, which means we don't get zillions
of NoExpose events.
@
text
@d297 79
@
2.5
log
@Parameters to all routines now (xp, p)
MAXROWS used in all routines
Junked most global communication variables
@
text
@d345 1
d348 2
a349 1
pixgc = XCreateGC(xp->d, pix, GCForeground | GCBackground, &gcv);
@
2.4
log
@Simplified; copyplane code moved into here
@
text
@d1 23
d28 4
a31 5
static GC bggc, fggc;
static Window w;
static Pixmap pix;
static XPoint points[NUMPOINTS];
static XSegment *segsa, *segsb;
d35 3
a37 3
Bool InitScrolling(d, p)
Display *d;
Parms p;
d41 1
a41 1
for (i = 0; i < NUMPOINTS; i++) {
d45 1
a45 2
CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
XDrawLines(d, w, fggc, points, NUMPOINTS, CoordModeOrigin);
d49 3
a51 3
void DoScrolling(d, p)
Display *d;
Parms p;
d53 1
a53 1
int i;
d55 22
a76 2
for (i=0; i<p->reps; i++) {
XCopyArea(d, w, w, fggc, 0, 1, WIDTH, HEIGHT - 1, 0, 0);
d80 3
a82 3
void MidScroll(d, p)
Display *d;
Parms p;
d84 2
a85 2
XClearArea(d, w, 0, 0, WIDTH, HEIGHT, False);
XDrawLines(d, w, fggc, points, NUMPOINTS, CoordModeOrigin);
d88 3
a90 3
void EndScrolling(d, p)
Display *d;
Parms p;
a91 3
XDestroyWindow(d, w);
XFreeGC(d, bggc);
XFreeGC(d, fggc);
d94 3
a96 3
void InitCopyLocations(d, p)
Display *d;
Parms p;
d121 1
a121 1
for (i=0; i<p->reps; i++) {
d155 3
a157 3
Bool InitCopyArea(d, p)
Display *d;
Parms p;
d159 2
a160 2
(void) InitScrolling(d, p);
InitCopyLocations(d, p);
d164 3
a166 3
Bool InitCopyArea2(d, p)
Display *d;
Parms p;
d168 1
a168 1
(void) InitCopyArea(d, p);
d171 4
a174 3
pix = XCreatePixmap(d, w, WIDTH, HEIGHT, DefaultDepth(d, DefaultScreen(d)));
XCopyArea(d, w, pix, fggc, 0, 0, WIDTH, HEIGHT, 0, 0);
XFillRectangle(d, w, bggc, 0, 0, WIDTH, HEIGHT);
d178 3
a180 3
void DoCopyArea(d, p)
Display *d;
Parms p;
d182 20
d206 9
a214 5
for (sa = segsa, sb = segsb, i=0; i<p->reps; i++, sa++, sb++) {
XCopyArea(d, w, w, fggc, sa->x1, sa->y1, size, size, sa->x2, sa->y2);
XCopyArea(d, w, w, fggc, sa->x2, sa->y2, size, size, sa->x1, sa->y1);
XCopyArea(d, w, w, fggc, sb->x2, sb->y2, size, size, sb->x1, sb->y1);
XCopyArea(d, w, w, fggc, sb->x1, sb->y1, size, size, sb->x2, sb->y2);
d218 3
a220 3
void DoCopyArea2(d, p)
Display *d;
Parms p;
d226 9
a234 5
for (sa = segsa, sb = segsb, i=0; i<p->reps; i++, sa++, sb++) {
XCopyArea(d, pix, w, fggc, sa->x1, sa->y1, size, size, sa->x2, sa->y2);
XCopyArea(d, pix, w, fggc, sa->x2, sa->y2, size, size, sa->x1, sa->y1);
XCopyArea(d, pix, w, fggc, sb->x2, sb->y2, size, size, sb->x1, sb->y1);
XCopyArea(d, pix, w, fggc, sb->x1, sb->y1, size, size, sb->x2, sb->y2);
d238 3
a240 3
void MidCopyArea2(d, p)
Display *d;
Parms p;
d242 33
a274 1
XClearArea(d, w, 0, 0, WIDTH, HEIGHT, False);
d277 3
a279 3
void EndCopyArea(d, p)
Display *d;
Parms p;
d281 28
a308 1
EndScrolling(d, w);
d313 3
a315 3
void EndCopyArea2(d, p)
Display *d;
Parms p;
d317 2
a318 2
EndCopyArea(d, p);
XFreePixmap(d, pix);
d321 3
a323 3
Bool InitCopyPlane(d, p)
Display *d;
Parms p;
d325 3
a327 3
int i;
XGCValues gcv;
GC pixgc;
d329 9
a337 1
for (i = 0; i < NUMPOINTS; i++) {
d341 1
a341 2
CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
InitCopyLocations(d, p);
d344 1
a344 1
pix = XCreatePixmap(d, w, WIDTH, HEIGHT, 1);
d347 2
a348 2
pixgc = XCreateGC(d, pix, GCForeground | GCBackground, &gcv);
XFillRectangle(d, pix, pixgc, 0, 0, WIDTH, HEIGHT);
d351 3
a353 3
XChangeGC(d, pixgc, GCForeground | GCBackground, &gcv);
XDrawLines(d, pix, pixgc, points, NUMPOINTS, CoordModeOrigin);
XFreeGC(d, pixgc);
d358 3
a360 3
void DoCopyPlane(d, p)
Display *d;
Parms p;
d362 2
a363 2
int i, size;
XSegment *sa, *sb;
d366 9
a374 9
for (sa = segsa, sb = segsb, i=0; i<p->reps; i++, sa++, sb++) {
XCopyPlane(
d, pix, w, fggc, sa->x1, sa->y1, size, size, sa->x2, sa->y2, 1);
XCopyPlane(
d, pix, w, fggc, sa->x2, sa->y2, size, size, sa->x1, sa->y1, 1);
XCopyPlane(
d, pix, w, fggc, sb->x2, sb->y2, size, size, sb->x1, sb->y1, 1);
XCopyPlane(
d, pix, w, fggc, sb->x1, sb->y1, size, size, sb->x2, sb->y2, 1);
@
2.3
log
@Create pixmap using default depth, not hardwired 8
@
text
@d13 43
d121 1
a121 10
int i;
w = None;
for (i = 0; i < NUMPOINTS; i++)
{
points[i].x = rand() % WIDTH;
points[i].y = rand() % HEIGHT;
}
CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
XDrawLines(d, w, fggc, points, NUMPOINTS, CoordModeOrigin);
a122 2
XSync(d, 0);
d130 1
a130 1
int i;
d132 1
a132 10
w = None;
i = 0;
for (i = 0; i < NUMPOINTS; i++)
{
points[i].x = rand() % WIDTH;
points[i].y = rand() % HEIGHT;
}
CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
/* Create depth-8 pixmap to write stuff into, and clear it out */
d134 2
a135 5
XFillRectangle(d, pix, bggc, 0, 0, WIDTH, HEIGHT);
XDrawLines(d, pix, fggc, points, NUMPOINTS, CoordModeOrigin);
InitCopyLocations(d, p);
XSync(d, 0);
a170 9
void MidCopyArea(d, p)
Display *d;
Parms p;
{
XClearArea(d, w, 0, 0, WIDTH, HEIGHT, False);
XDrawLines(d, w, fggc, points, NUMPOINTS, CoordModeOrigin);
XSync(d, 0);
}
a175 1
XSync(d, 0);
d182 1
a182 4
if (w != None)
XDestroyWindow(d, w);
XFreeGC(d, bggc);
XFreeGC(d, fggc);
d192 51
a242 2
if (pix != None)
XFreePixmap(d, pix);
@
2.2
log
@Don't need stdio.h
@
text
@a7 9
static XRectangle pixrect[] = {
0, 0, WIDTH, HEIGHT
};
static XRectangle ws[3] = {
{100, 100, 200, 200},
{150, 150, 200, 200},
{200, 200, 200, 200}
};
d110 2
a111 2
pix = XCreatePixmap(d, w, 800, HEIGHT, 8);
XFillRectangles(d, pix, bggc, pixrect, 1);
@
2.1
log
@Massive changes, I'm not going to go into details.
@
text
@a1 1
#include <stdio.h>
@
2.0
log
@version from /usr/src/pmax
@
text
@d2 1
d8 5
d19 1
d21 3
a23 1
void InitCopyArea(d, p)
d27 61
a88 1
XGCValues gcv;
a90 1
i = 0;
d98 2
d101 1
d104 1
a104 1
void DoCopyArea(d, p)
d110 6
a115 6
for (i=0; i<p->reps; i++)
{
XCopyArea(d, w, w, fggc, rand() % WIDTH, rand() % HEIGHT,
200, 200, rand() % WIDTH, rand() % HEIGHT);
d117 10
d129 32
d165 1
d170 8
a181 1
int i;
d186 11
@
1.2
log
@Added -fg -bg capabilities
@
text
@@
1.1
log
@Initial revision
@
text
@d5 1
a5 1
static GC whitegc, blackgc;
d28 2
a29 2
CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &whitegc, &blackgc);
XDrawLines(d, w, blackgc, points, NUMPOINTS, CoordModeOrigin);
d43 1
a43 1
XCopyArea(d, w, w, blackgc, rand() % WIDTH, rand() % HEIGHT,
d52 1
a52 1
XDrawLines(d, w, blackgc, points, NUMPOINTS, CoordModeOrigin);
d63 2
a64 2
XFreeGC(d, whitegc);
XFreeGC(d, blackgc);
@