Create cairo context in expose callback
This commit is contained in:
committed by
Stéphane Lesimple
parent
6dc80bb542
commit
5da5fa54dc
@@ -32,7 +32,7 @@
|
||||
*** Forward declarations
|
||||
***/
|
||||
|
||||
static void redraw_curve(RS01Widgets*);
|
||||
static void redraw_curve(cairo_t *cr, RS01Widgets*);
|
||||
static void update_geometry(RS01Widgets*);
|
||||
|
||||
/* Protected widget access */
|
||||
@@ -257,19 +257,18 @@ static void update_geometry(RS01Widgets *wl)
|
||||
TRUE, TRUE, wl->fixCurve->leftX, GTK_PACK_START);
|
||||
}
|
||||
|
||||
static void redraw_curve(RS01Widgets *wl)
|
||||
static void redraw_curve(cairo_t *cr, RS01Widgets *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);
|
||||
@@ -282,14 +281,15 @@ static void redraw_curve(RS01Widgets *wl)
|
||||
*/
|
||||
|
||||
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{ RS01Widgets *wl = (RS01Widgets*)data;
|
||||
{ cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget)));
|
||||
RS01Widgets *wl = (RS01Widgets*)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