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_plane.c,v
< prev
next >
Wrap
Text File
|
1989-05-09
|
4KB
|
222 lines
head 2.2;
access ;
symbols pre-merge:2.0;
locks ; strict;
comment @ * @;
2.2
date 89.05.08.18.33.45; author joel; state Exp;
branches ;
next 2.1;
2.1
date 89.05.03.14.17.45; author joel; state Exp;
branches ;
next 2.0;
2.0
date 89.01.31.17.04.41; author erik; state Exp;
branches ;
next 1.3;
1.3
date 89.01.31.17.04.41; author joel; state Exp;
branches ;
next 1.2;
1.2
date 89.01.05.18.28.38; author joel; state Exp;
branches ;
next 1.1;
1.1
date 88.12.15.13.40.59; author joel; state Exp;
branches ;
next ;
desc
@CopyPlane benchmark code
@
2.2
log
@Code merged into do_copyarea.c
@
text
@@
2.1
log
@Massive changes, I'm not going to go into details.
@
text
@a0 105
#include "x11perf.h"
static Window w;
static char **charBuf = NULL;
static GC fggc, bggc;
static XFontStruct *font;
static int height, ypos, lines;
static Pixmap pixmap;
#define XPOS 20
#define SEGMENTS 3
#define STARTBOLD 20
#define NUMBOLD 20
#define max(why, me) (((why) > (me)) ? why : me)
Bool InitCopyPlane(d, p)
Display *d;
Parms p;
{
int i, j;
XGCValues gcv;
GC pixgc;
font = XLoadQueryFont (d, p->font);
if (font == NULL) {
printf("Could not load font '%s', benchmark omitted\n", p->font);
return False;
}
ypos = XPOS;
height = max(font->max_bounds.ascent, font->ascent) +
max(font->max_bounds.descent, font->descent) + 1;
lines = (HEIGHT - ypos) / height;
CreatePerfStuff (d, 1, 800, HEIGHT, &w, &bggc, &fggc);
if (charBuf == NULL) {
charBuf = (char **) malloc(lines*sizeof (char *));
for (i = 0; i < lines; i++) {
charBuf[i] = (char *) malloc (sizeof (char)*CHARS);
for (j = 0; j < CHARS; j++) {
charBuf[i][j] = ' ' + (rand () % ('\177' - ' '));
}
}
}
/* Create depth-1 pixmap to write stuff into */
pixmap = XCreatePixmap(d, w, 800, HEIGHT, 1);
/* Create gc to go with it */
gcv.foreground = 1;
gcv.background = 0;
gcv.font = font->fid;
pixgc = XCreateGC(d, pixmap,
GCForeground | GCBackground | GCFont, &gcv);
/* Write text into the pixmap */
for (i = 0; i < lines; i++) {
XDrawString(d, pixmap, pixgc, XPOS, ypos, charBuf[i], CHARS);
ypos += height;
}
XFreeGC(d, pixgc);
return True;
}
void DoCopyPlane(d, p)
Display *d;
Parms p;
{
int i;
for (i = 0; i < p->reps; i++) {
XCopyPlane(d, pixmap, w, (i & 1) ? fggc : bggc,
0, 0, 800, HEIGHT,
0, 0, 1);
/* other configurations for making sure clipping works
20, 20, 800-40, HEIGHT-40,
20, 20, 1);
*/
/*
-20, -20, 800-40, HEIGHT+40,
0, 0, 1);
*/
}
}
void EndCopyPlane(d, p)
Display *d;
Parms p;
{
int i;
XDestroyWindow(d, w);
XFreePixmap(d, pixmap);
XFreeGC(d, fggc);
XFreeGC(d, bggc);
for (i = 0; i < lines; i++)
free(charBuf[i]);
free(charBuf);
charBuf = NULL;
XFreeFont(d, font);
}
@
2.0
log
@version from /usr/src/pmax
@
text
@d17 1
a17 1
void InitCopyPlane(d, p)
d26 5
d65 1
d78 1
a78 1
/* other configurations for making sure clipping works still
@
1.3
log
@Added -fg -bg capabilities
@
text
@@
1.2
log
@Added a few weird cases that can be uncommented.
@
text
@d5 1
a5 1
static GC blackgc, whitegc;
d31 1
a31 1
CreatePerfStuff (d, 1, 800, HEIGHT, &w, &whitegc, &blackgc);
d48 2
a49 2
gcv.foreground = 1 /* BlackPixel(d, 0) */;
gcv.background = 0 /* WhitePixel(d, 0) */;
d69 1
a69 1
XCopyPlane(d, pixmap, w, (i & 1) ? blackgc : whitegc,
d91 2
a92 2
XFreeGC(d, blackgc);
XFreeGC(d, whitegc);
@
1.1
log
@Initial revision
@
text
@d72 8
@