optimized XCopyArea for draw_graph(flags & 1), removed redundant OUTSIDE macro
This commit is contained in:
parent
11c8c47ad3
commit
e282abb5f1
23
src/draw.c
23
src/draw.c
|
|
@ -519,7 +519,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
x2=X_TO_SCREEN(xctx->inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx->inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN(xctx->inst[n].y2+yoffset);
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
if(RECT_OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -744,7 +744,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
x2=X_TO_SCREEN(xctx->inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx->inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN (xctx->inst[n].y2+yoffset);
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
if(RECT_OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -3494,9 +3494,11 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
my_free(_ALLOC_ID_, &measure_x);
|
||||
my_free(_ALLOC_ID_, &measure_prev_x);
|
||||
} /* if(flags & 8) */
|
||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
||||
bbox(SET_INSIDE, 0.0, 0.0, 0.0, 0.0);
|
||||
/*
|
||||
* bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
* bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
||||
* bbox(SET_INSIDE, 0.0, 0.0, 0.0, 0.0);
|
||||
*/
|
||||
if(flags & 8) {
|
||||
/* cursor1 */
|
||||
if((flags & 2)) draw_cursor(xctx->graph_cursor1_x, xctx->graph_cursor2_x, 1, gr);
|
||||
|
|
@ -3507,11 +3509,16 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
}
|
||||
if(flags & 1) { /* copy save buffer to screen */
|
||||
if(!xctx->draw_window) {
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
/*
|
||||
* MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
* xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
*/
|
||||
MyXCopyAreaDouble(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
|
||||
gr->rx1, gr->ry1, gr->rx2, gr->ry2, gr->rx1, gr->ry1, 0.0);
|
||||
|
||||
}
|
||||
}
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
/* bbox(END, 0.0, 0.0, 0.0, 0.0); */
|
||||
}
|
||||
|
||||
/* flags:
|
||||
|
|
|
|||
|
|
@ -792,7 +792,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
x2=X_TO_PS(xctx->inst[n].x2);
|
||||
y1=Y_TO_PS(xctx->inst[n].y1);
|
||||
y2=Y_TO_PS(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
if(RECT_OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1320,7 +1320,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
int k, selected_points, flag;
|
||||
|
||||
polygon_bbox(xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, &xa, &ya, &xb, &yb);
|
||||
if(OUTSIDE(xa, ya, xb, yb, x1, y1, x2, y2)) continue;
|
||||
if(RECT_OUTSIDE(xa, ya, xb, yb, x1, y1, x2, y2)) continue;
|
||||
selected_points = 0;
|
||||
flag=0;
|
||||
for(k=0; k<xctx->poly[c][i].points; ++k) {
|
||||
|
|
@ -1513,7 +1513,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
int k, flag;
|
||||
|
||||
polygon_bbox(xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, &xa, &ya, &xb, &yb);
|
||||
if(OUTSIDE(xa, ya, xb, yb, x1, y1, x2, y2)) continue;
|
||||
if(RECT_OUTSIDE(xa, ya, xb, yb, x1, y1, x2, y2)) continue;
|
||||
flag=0;
|
||||
for(k=0; k<xctx->poly[c][i].points; ++k) {
|
||||
if(xctx->poly[c][i].sel==SELECTED) xctx->poly[c][i].selected_point[k] = 1;
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
|||
x2=X_TO_SVG(xctx->inst[n].x2);
|
||||
y1=Y_TO_SVG(xctx->inst[n].y1);
|
||||
y2=Y_TO_SVG(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) {
|
||||
if(RECT_OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) {
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,9 +346,6 @@ extern char win_temp_dir[PATH_MAX];
|
|||
if(y2 < y1) {xxtmp = y1; y1 = y2; y2 = xxtmp;} \
|
||||
}
|
||||
|
||||
#define OUTSIDE(xa,ya,xb,yb,x1,y1,x2,y2) \
|
||||
(xa>x2 || xb<x1 || ya>y2 || yb<y1 )
|
||||
|
||||
#define LINE_OUTSIDE(xa,ya,xb,yb,x1,y1,x2,y2) \
|
||||
(xa>=x2 || xb<=x1 || ( (ya<yb)? (ya>=y2 || yb<=y1) : (yb>=y2 || ya<=y1) ) )
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue