[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
2674.0. "Draw lines on FireFox" by TAVHLT::DORON (Doing my BEST !!!) Fri Apr 27 1990 02:47
Hi There !
We have a customer who is interested in a large purchase
of Firefox systems ( approxiamtely $1M of equipment ).
Unfortunately the customer in one of his benchmarks uncovered
a bug in the Firfox server which follows.
The program is written under VMS 5.3-1. The machine is VS3540.
The program displays various line types at various line lengths.
For example a line displayed across the screen is composed of
individual polyline line segments. The problem occurs when
displaying more than 200 line segments as a single line across
the screen. If the line width for the line segments is "nominal
width" then the line does not appear on the screen. However if we
explicitly state line width = 1 then everything is o.k, but takes
longer in the benchmark to process, which does not delight our
customer ( exceeding his time limit ).
To run the program do the following :
$ testv:==$mydir:testv
$ testv -l 10 This program should work fine and you will see
the lines on the screen.
Depressing mb2 will cause the line width to change.
$ testv -l 200 This program will display junk or nothing on the
screen as the line width is set to the nominal
line width. Depressing mb2 at this point will
cause the lines to appear after about 2 seconds
because the line width has now been explicitly
made > = 1.
Please note when running testv -l 200 after testv -l 10 will sometimes
display the lines correct, because it is using the pixmap from the
previous test and therefore everything looks fine. To see the true
problem, depress MB2 once. Then depress mb2 again and you will see
the lines cause the line width is now being explicitly stated.
I would like to emphasize once again the urgency and importance
of finding a solution to the problem ( other than explicitly setting
the line width to 1 ) as the customer is one of Digital's largest
and most important customers.
Enclosed is a copy of the C source code.
Thank you in advance for your assistance. We look forward
to your speedy ( PLEASE ) reply.
Doron Angel
------------------------------Cut here----------------------------------------
#include <stdio.h>
#include <decw$include/xlib.h>
#include <decw$include/xutil.h>
#define WIDTH 1200
#define HEIGHT 900
#define X 0
#define Y 0
#define BLACK 0
#define RED 1
#define BLUE 2
#define WHITE 3
#define DEPTH 8
static char solid_list[] = {1,1};
static char dot_list[] = {1,6};
static char dot_dash_list[] = {1,6,4,6};
static char short_dash_list[] = {4,6};
static char long_dash_list[] = {8,6};
static char dash_list[] = {6,6};
static char short_dash_long_dash_list[] = {4,6,8,6};
static char three_dots_long_dash_list[] = {1,6,1,6,1,6,8,6};
typedef struct {
int dash_size;
char *dash_list;
} DashType, *DashTypes;
#define dash_entry(list) sizeof(list)/sizeof(list[0]), list
static DashType dashes[] = {
{ dash_entry(solid_list) },
{ dash_entry(dot_list) },
{ dash_entry(dot_dash_list) },
{ dash_entry(short_dash_list) },
{ dash_entry(long_dash_list) },
{ dash_entry(dash_list) },
{ dash_entry(short_dash_long_dash_list) },
{ dash_entry(three_dots_long_dash_list) }
};
static int nDashes = sizeof(dashes) / sizeof (dashes[0]);
static char *cap_names[] = {
"CapNotLast",
"CapButt",
"CapRound",
"CapProjecting"
};
static char *join_names[] = {
"JoinMiter",
"JoinRound",
"JoinBevel"
};
static Display *display;
static Window window;
static Pixmap pixmap;
static GC clearGC;
static GC defGC;
static GC dashGC;
static int cap = 0;
static int join= 0;
static int nLines = 10;
static XPoint *lines[16];
/*
** Build Lines
*/
static BuildLines()
{
register i,j;
XPoint *p;
float sx = ((float)(WIDTH-200)) / nLines;
for (i=0; i<nDashes; i++) {
lines[i] = p = calloc (nLines, sizeof(XPoint));
for (j=0; j<nLines; j++, p++) {
p->x = j*sx + 100;
p->y = i*100 + 50;
}
}
}
/*
** Draw The Lines on Expose Event
*/
static DrawLines( target, lw )
Drawable target;
int lw;
{
register i;
/*
** Clear the target
*/
XFillRectangle(display,target,clearGC,0,0,WIDTH,HEIGHT);
/*
** Draw Dashed lines with various dash patterns
*/
XSetLineAttributes(display,dashGC, lw, LineOnOffDash, cap, join);
for (i=0; i<nDashes; i++) {
XSetDashes(display,dashGC,
0, /* Dash Offset */
dashes[i].dash_list, /* Dash List */
dashes[i].dash_size); /* Dash List size */
XDrawLines (display,target,dashGC,
lines[i], nLines, CoordModeOrigin);
}
}
/*
** Show Pixmap
*/
static ShowPixmap()
{
XClearWindow(display,window);
XFlush(display);
}
/*
** Create Window and its Pixmap of depth 8 for PseudoColor Visual
*/
static CreateWindow(dpy)
Display *dpy;
{
Colormap map;
XVisualInfo xvi;
XSetWindowAttributes wa;
int wa_flags;
XColor color;
/*
** Find PseudoColor and Create Colormap
*/
if (!XMatchVisualInfo(dpy,0,DEPTH,PseudoColor,&xvi)) {
printf("Can't match PseudoColor Visual of Depth 8\n");
exit(1);
}
map = XCreateColormap(dpy,DefaultRootWindow(dpy),xvi.visual,AllocAll);
{
XColor color;
/*
** SetUp Colormap
*/
color.flags = DoRed | DoGreen | DoBlue;
/* Black */
color.pixel = BLACK;
color.red = color.green = color.blue = 0;
XStoreColor(dpy,map,&color);
/* Red */
color.pixel = RED;
color.red = 0xFF00;
color.green = color.blue = 0;
XStoreColor(dpy,map,&color);
/* Blue */
color.pixel = BLUE;
color.blue = 0xFF00;
color.red = color.green = 0;
XStoreColor(dpy,map,&color);
/* White */
color.pixel = WHITE;
color.red = color.green = color.blue = 0xff00;
XStoreColor(dpy,map,&color);
}
/*
** Create Pixmap
*/
pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy),
WIDTH, HEIGHT, DEPTH);
/*
** Create the window
*/
wa.background_pixmap = pixmap;
wa.border_pixel = 0;
wa.colormap = map;
wa.event_mask = ButtonPressMask;
wa_flags = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
window = XCreateWindow(
dpy, DefaultRootWindow(dpy),
X, Y,
WIDTH, HEIGHT,
1, DEPTH, InputOutput, xvi.visual,
wa_flags, &wa);
/*
** Set Basic Parms in GC
*/
clearGC = XCreateGC(display,window ,0,NULL);
XSetState(display,clearGC, 0, 0, GXclear, AllPlanes);
defGC = XCreateGC(display,window,0,NULL);
XSetState(display,defGC, RED, BLUE, GXcopy, AllPlanes);
dashGC = XCreateGC(display,window,0,NULL);
XSetState(display,dashGC, RED, BLUE, GXcopy, AllPlanes);
/*
** Map the Window and Install Colormap
*/
XMapWindow (dpy, window);
XInstallColormap (dpy, map);
}
main(argc,argv)
unsigned int argc;
char *argv[];
{
register i;
int lineWidth = 0;
XEvent event;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i],"-c")) {
cap = atoi(argv[++i]);
if (cap > 3) cap = 0;
}
else if (!strcmp(argv[i],"-j")) {
join = atoi(argv[++i]);
if (join > 2) join = 0;
}
else if (!strcmp(argv[i],"-l")) {
nLines = atoi(argv[++i]);
}
}
printf("Cap style is %s\n",cap_names[cap]);
printf("Join style is %s\n",join_names[join]);
printf("Number of Lines %d\n",nLines);
BuildLines(nLines);
/*
** Open the display
*/
if (!(display= XOpenDisplay(NULL))) {
printf("Can't open the display");
exit(1);
}
CreateWindow(display);
while(1) {
XNextEvent(display,&event);
switch (event.type) {
case ButtonPress:
if (event.xbutton.button == Button3)
exit(1);
else if (event.xbutton.button == Button2) {
lib$init_timer();
DrawLines(pixmap, lineWidth);
ShowPixmap();
XSync(display,FALSE);
lib$show_timer();
printf("Line Width is %d\n",lineWidth);
lineWidth++;
}
break;
default:
break;
}
}
}
T.R | Title | User | Personal Name | Date | Lines |
---|
2674.1 | | JAMMER::JACK | Marty Jack | Fri Apr 27 1990 11:16 | 3 |
| I do hope if it is as important a situation as you say, you are
pursuing it via a CLD or other escalation means, and not relying on
someone to read this conference.
|
2674.2 | | TAVHLT::DORON | Doing my BEST !!! | Fri Apr 27 1990 15:45 | 13 |
|
> I do hope if it is as important a situation as you say, you are
> pursuing it via a CLD or other escalation means, and not relying on
> someone to read this conference.
The CLD will be issued only on the coming Sunday (weekend in Israel is on
Friday & Saturday). Since it is a non working in the U.S.A. on Sunday, and we
are celebrating Independance Day on coming monday, I hope some one the has seen
this problem before and his reply would have shorten things...
*-Doron-*
|