replace cairo_image_surface_create_for_data with cairo_image_surface_create in create_memory_cairo_ctx
This commit is contained in:
parent
9b8015b437
commit
e4ef7d4dc1
|
|
@ -3378,12 +3378,10 @@ void create_memory_cairo_ctx(int what)
|
||||||
{
|
{
|
||||||
#if HAS_CAIRO==1
|
#if HAS_CAIRO==1
|
||||||
static int created = 0;
|
static int created = 0;
|
||||||
enum { w = 100, h = 64, bpp = 4 };
|
enum { w = 200, h = 150};
|
||||||
static unsigned char data[w * h * bpp];
|
|
||||||
|
|
||||||
if(!created && what && !xctx->cairo_ctx) {
|
if(!created && what && !xctx->cairo_ctx) {
|
||||||
xctx->cairo_sfc = cairo_image_surface_create_for_data(data,
|
xctx->cairo_sfc = cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
|
||||||
CAIRO_FORMAT_RGB24, w, h, bpp * w);
|
|
||||||
xctx->cairo_ctx = cairo_create(xctx->cairo_sfc);
|
xctx->cairo_ctx = cairo_create(xctx->cairo_sfc);
|
||||||
if(xctx->cairo_ctx) created = 1;
|
if(xctx->cairo_ctx) created = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -907,6 +907,7 @@ static void xwin_exit(void)
|
||||||
}
|
}
|
||||||
if(xctx->infowindow_text) my_free(_ALLOC_ID_, &xctx->infowindow_text);
|
if(xctx->infowindow_text) my_free(_ALLOC_ID_, &xctx->infowindow_text);
|
||||||
if(has_x) new_schematic("destroy_all", "1", NULL, 1);
|
if(has_x) new_schematic("destroy_all", "1", NULL, 1);
|
||||||
|
else create_memory_cairo_ctx(0); /* clear in-memory created cairo_ctx if any */
|
||||||
drawbezier(xctx->window, xctx->gc[0], 0, NULL, NULL, 0, 0);
|
drawbezier(xctx->window, xctx->gc[0], 0, NULL, NULL, 0, 0);
|
||||||
delete_schematic_data(1);
|
delete_schematic_data(1);
|
||||||
if(has_x) {
|
if(has_x) {
|
||||||
|
|
@ -925,8 +926,6 @@ static void xwin_exit(void)
|
||||||
for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]);
|
for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]);
|
||||||
#endif
|
#endif
|
||||||
my_free(_ALLOC_ID_, &pixmap);
|
my_free(_ALLOC_ID_, &pixmap);
|
||||||
} else { /* no X */
|
|
||||||
create_memory_cairo_ctx(0); /* clear in-memory created cairo_ctx if any */
|
|
||||||
}
|
}
|
||||||
dbg(1, "xwin_exit(): clearing drawing data structures\n");
|
dbg(1, "xwin_exit(): clearing drawing data structures\n");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue