Create cairo context in expose callback
This commit is contained in:
committed by
Stéphane Lesimple
parent
6dc80bb542
commit
5da5fa54dc
@@ -31,7 +31,7 @@
|
||||
*** Forward declarations
|
||||
***/
|
||||
|
||||
static void redraw_curve(RS03Widgets*);
|
||||
static void redraw_curve(cairo_t *cr, RS03Widgets*);
|
||||
static void update_geometry(RS03Widgets*);
|
||||
|
||||
/***
|
||||
@@ -227,19 +227,18 @@ static void update_geometry(RS03Widgets *wl)
|
||||
TRUE, TRUE, wl->fixCurve->leftX, GTK_PACK_START);
|
||||
}
|
||||
|
||||
static void redraw_curve(RS03Widgets *wl)
|
||||
static void redraw_curve(cairo_t *cr, RS03Widgets *wl)
|
||||
{ int y;
|
||||
|
||||
/* Redraw the curve */
|
||||
|
||||
GuiRedrawAxes(wl->fixCurve);
|
||||
GuiRedrawCurve(wl->fixCurve, wl->percent);
|
||||
GuiRedrawAxes(cr, wl->fixCurve);
|
||||
GuiRedrawCurve(cr, wl->fixCurve, wl->percent);
|
||||
|
||||
/* Ecc capacity threshold line */
|
||||
|
||||
y = GuiCurveY(wl->fixCurve, wl->eccBytes);
|
||||
|
||||
cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(wl->fixCurve->widget));
|
||||
gdk_cairo_set_source_color(cr, Closure->greenSector);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_move_to(cr, wl->fixCurve->leftX-5.5, y+0.5);
|
||||
@@ -252,13 +251,14 @@ static void redraw_curve(RS03Widgets *wl)
|
||||
*/
|
||||
|
||||
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{ RS03Widgets *wl = (RS03Widgets*)data;
|
||||
{ cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget)));
|
||||
RS03Widgets *wl = (RS03Widgets*)data;
|
||||
|
||||
if(event->count) /* Exposure compression */
|
||||
return TRUE;
|
||||
|
||||
update_geometry(wl);
|
||||
redraw_curve(wl);
|
||||
redraw_curve(cr, wl);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user