app: use cairo_region_t for canvas items if cairo >= 1.10 is available

This is a gross hack that typedefs around between GdkRegion and
cairo_region_t and has some evil #ifdefs. This is going to die
immeditately once we can depend on cairo 1.10.
This commit is contained in:
Michael Natterer
2010-10-18 19:59:13 +02:00
parent 1130e8c890
commit 479082075b
22 changed files with 471 additions and 330 deletions

View File

@ -60,20 +60,20 @@ struct _GimpCanvasPolygonPrivate
/* local function prototypes */
static void gimp_canvas_polygon_finalize (GObject *object);
static void gimp_canvas_polygon_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_canvas_polygon_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_canvas_polygon_draw (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr);
static GdkRegion * gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
GimpDisplayShell *shell);
static void gimp_canvas_polygon_finalize (GObject *object);
static void gimp_canvas_polygon_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_canvas_polygon_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_canvas_polygon_draw (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr);
static cairo_region_t * gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
GimpDisplayShell *shell);
G_DEFINE_TYPE (GimpCanvasPolygon, gimp_canvas_polygon,
@ -246,7 +246,7 @@ gimp_canvas_polygon_draw (GimpCanvasItem *item,
g_free (points);
}
static GdkRegion *
static cairo_region_t *
gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
GimpDisplayShell *shell)
{
@ -285,7 +285,11 @@ gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
rectangle.width = x2 - x1;
rectangle.height = y2 - y1;
#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
#else
return gdk_region_rectangle (&rectangle);
#endif
}
GimpCanvasItem *