draw_image(): do RECTORDER() before taking *x1, *y1
This commit is contained in:
parent
adb855db0b
commit
a79e4304d9
|
|
@ -4363,8 +4363,8 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2,
|
||||||
size_t attr_len;
|
size_t attr_len;
|
||||||
|
|
||||||
if(xctx->only_probes) return 0;
|
if(xctx->only_probes) return 0;
|
||||||
xx1 = *x1; yy1 = *y1; /* image anchor point */
|
|
||||||
RECTORDER(*x1, *y1, *x2, *y2);
|
RECTORDER(*x1, *y1, *x2, *y2);
|
||||||
|
xx1 = *x1; yy1 = *y1; /* image anchor point */
|
||||||
|
|
||||||
/* screen position */
|
/* screen position */
|
||||||
sx1=X_TO_SCREEN(*x1);
|
sx1=X_TO_SCREEN(*x1);
|
||||||
|
|
@ -4414,6 +4414,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2,
|
||||||
dbg(1, "draw_image() w=%d, h=%d\n", w, h);
|
dbg(1, "draw_image() w=%d, h=%d\n", w, h);
|
||||||
x = X_TO_SCREEN(xx1);
|
x = X_TO_SCREEN(xx1);
|
||||||
y = Y_TO_SCREEN(yy1);
|
y = Y_TO_SCREEN(yy1);
|
||||||
|
dbg(1, "draw_image() x=%g, y=%g\n", x, y);
|
||||||
if(r->flags & 2048) { /* resize container rectangle to fit image */
|
if(r->flags & 2048) { /* resize container rectangle to fit image */
|
||||||
*x2 = *x1 + w;
|
*x2 = *x1 + w;
|
||||||
*y2 = *y1 + h;
|
*y2 = *y1 + h;
|
||||||
|
|
@ -4432,6 +4433,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2,
|
||||||
scaley = rh/h * xctx->mooz;
|
scaley = rh/h * xctx->mooz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dbg(1, "draw_image() : rectangle coords: %g %g %g %g\n", *x1, *y1, *x2, *y2);
|
||||||
if(dr) {
|
if(dr) {
|
||||||
cairo_save(xctx->cairo_ctx);
|
cairo_save(xctx->cairo_ctx);
|
||||||
cairo_save(xctx->cairo_save_ctx);
|
cairo_save(xctx->cairo_save_ctx);
|
||||||
|
|
@ -4442,7 +4444,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2,
|
||||||
if(flip && (rot == 0 || rot == 2)) cairo_scale(xctx->cairo_save_ctx, -scalex, scaley);
|
if(flip && (rot == 0 || rot == 2)) cairo_scale(xctx->cairo_save_ctx, -scalex, scaley);
|
||||||
else if(flip && (rot == 1 || rot == 3)) cairo_scale(xctx->cairo_save_ctx, -scalex, scaley);
|
else if(flip && (rot == 1 || rot == 3)) cairo_scale(xctx->cairo_save_ctx, -scalex, scaley);
|
||||||
else cairo_scale(xctx->cairo_save_ctx, scalex, scaley);
|
else cairo_scale(xctx->cairo_save_ctx, scalex, scaley);
|
||||||
|
|
||||||
cairo_set_source_surface(xctx->cairo_save_ctx, emb_ptr->image, 0. , 0.);
|
cairo_set_source_surface(xctx->cairo_save_ctx, emb_ptr->image, 0. , 0.);
|
||||||
cairo_rectangle(xctx->cairo_save_ctx, 0, 0, w , h );
|
cairo_rectangle(xctx->cairo_save_ctx, 0, 0, w , h );
|
||||||
/* cairo_fill(xctx->cairo_save_ctx);
|
/* cairo_fill(xctx->cairo_save_ctx);
|
||||||
|
|
|
||||||
|
|
@ -3555,6 +3555,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
||||||
}
|
}
|
||||||
if(w == 0) w = (int) fabs(x2 - x1);
|
if(w == 0) w = (int) fabs(x2 - x1);
|
||||||
if(h == 0) h = (int) fabs(y2 - y1);
|
if(h == 0) h = (int) fabs(y2 - y1);
|
||||||
|
dbg(1, "w=%d h=%d, lw=%g bbox=%g %g %g %g\n", w, h, xctx->lw, x1, y1, x2, y2);
|
||||||
save_restore_zoom(1, &zi);
|
save_restore_zoom(1, &zi);
|
||||||
set_viewport_size(w, h, xctx->lw);
|
set_viewport_size(w, h, xctx->lw);
|
||||||
zoom_box(x1, y1, x2, y2, 1.0);
|
zoom_box(x1, y1, x2, y2, 1.0);
|
||||||
|
|
|
||||||
|
|
@ -2120,6 +2120,7 @@ static void resetcairo(int create, int clear, int force_or_resize)
|
||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
xctx->cairo_save_sfc = cairo_xlib_surface_create(display, xctx->save_pixmap,
|
xctx->cairo_save_sfc = cairo_xlib_surface_create(display, xctx->save_pixmap,
|
||||||
visual, xctx->xrect[0].width, xctx->xrect[0].height);
|
visual, xctx->xrect[0].width, xctx->xrect[0].height);
|
||||||
|
dbg(1, "resetcairo: create cairo_save_sfc: %d %d\n", xctx->xrect[0].width, xctx->xrect[0].height);
|
||||||
#else
|
#else
|
||||||
xctx->cairo_save_sfc = cairo_win32_surface_create_with_dib(CAIRO_FORMAT_RGB24,
|
xctx->cairo_save_sfc = cairo_win32_surface_create_with_dib(CAIRO_FORMAT_RGB24,
|
||||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue