mirror of https://github.com/GNOME/gimp.git
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:
parent
1130e8c890
commit
479082075b
app/display
display-types.hgimpcanvasarc.cgimpcanvasboundary.cgimpcanvascorner.cgimpcanvascursor.cgimpcanvasgrid.cgimpcanvasgroup.cgimpcanvasguide.cgimpcanvashandle.cgimpcanvasitem.cgimpcanvasitem.hgimpcanvaslayerboundary.cgimpcanvasline.cgimpcanvaspath.cgimpcanvaspen.cgimpcanvaspolygon.cgimpcanvasrectangle.cgimpcanvassamplepoint.cgimpcanvastextcursor.cgimpdisplayshell-expose.cgimpdisplayshell-expose.hgimpdisplayshell-items.c
|
@ -24,6 +24,15 @@
|
|||
#include "display/display-enums.h"
|
||||
|
||||
|
||||
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
|
||||
#define USE_CAIRO_REGION
|
||||
#endif
|
||||
|
||||
#ifndef USE_CAIRO_REGION
|
||||
typedef GdkRegion cairo_region_t;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _GimpCanvas GimpCanvas;
|
||||
typedef struct _GimpCanvasItem GimpCanvasItem;
|
||||
typedef struct _GimpCanvasGroup GimpCanvasGroup;
|
||||
|
|
|
@ -69,19 +69,19 @@ struct _GimpCanvasArcPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_arc_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_arc_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_arc_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_arc_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_arc_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_arc_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_arc_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_arc_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasArc, gimp_canvas_arc,
|
||||
|
@ -288,7 +288,7 @@ gimp_canvas_arc_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_arc_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -305,7 +305,11 @@ gimp_canvas_arc_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (center_x + radius_x + 1.5) - rectangle.x;
|
||||
rectangle.height = ceil (center_y + radius_y + 1.5) - rectangle.y;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -68,20 +68,20 @@ struct _GimpCanvasBoundaryPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_boundary_finalize (GObject *object);
|
||||
static void gimp_canvas_boundary_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_boundary_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_boundary_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_boundary_finalize (GObject *object);
|
||||
static void gimp_canvas_boundary_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_boundary_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_boundary_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasBoundary, gimp_canvas_boundary,
|
||||
|
@ -301,7 +301,7 @@ gimp_canvas_boundary_draw (GimpCanvasItem *item,
|
|||
g_free (segs);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -340,7 +340,11 @@ gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = x2 - x1 + 4;
|
||||
rectangle.height = y2 - y1 + 4;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -69,19 +69,19 @@ struct _GimpCanvasCornerPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_corner_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_corner_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_corner_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_corner_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_corner_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_corner_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_corner_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_corner_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasCorner, gimp_canvas_corner,
|
||||
|
@ -408,7 +408,7 @@ gimp_canvas_corner_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_corner_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -423,7 +423,11 @@ gimp_canvas_corner_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (w + 3.0);
|
||||
rectangle.height = ceil (h + 3.0);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -62,19 +62,19 @@ struct _GimpCanvasCursorPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_cursor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_cursor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_cursor_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_cursor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_cursor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_cursor_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasCursor, gimp_canvas_cursor,
|
||||
|
@ -183,7 +183,7 @@ gimp_canvas_cursor_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -199,7 +199,11 @@ gimp_canvas_cursor_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (x + GIMP_CURSOR_SIZE + 1.5) - rectangle.x;
|
||||
rectangle.height = ceil (y + GIMP_CURSOR_SIZE + 1.5) - rectangle.y;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -63,23 +63,23 @@ struct _GimpCanvasGridPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_grid_finalize (GObject *object);
|
||||
static void gimp_canvas_grid_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_grid_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_grid_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_grid_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_grid_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_grid_finalize (GObject *object);
|
||||
static void gimp_canvas_grid_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_grid_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_grid_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_grid_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_grid_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasGrid, gimp_canvas_grid, GIMP_TYPE_CANVAS_ITEM)
|
||||
|
@ -340,7 +340,7 @@ gimp_canvas_grid_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_grid_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -364,7 +364,11 @@ gimp_canvas_grid_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (x2) - rectangle.x;
|
||||
rectangle.height = ceil (y2) - rectangle.y;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -58,23 +58,23 @@ struct _GimpCanvasGroupPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_group_dispose (GObject *object);
|
||||
static void gimp_canvas_group_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_group_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_group_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_group_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_group_child_update (GimpCanvasItem *item,
|
||||
GdkRegion *region,
|
||||
GimpCanvasGroup *group);
|
||||
static void gimp_canvas_group_dispose (GObject *object);
|
||||
static void gimp_canvas_group_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_group_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_group_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_group_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_group_child_update (GimpCanvasItem *item,
|
||||
cairo_region_t *region,
|
||||
GimpCanvasGroup *group);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasGroup, gimp_canvas_group, GIMP_TYPE_CANVAS_ITEM)
|
||||
|
@ -198,18 +198,18 @@ gimp_canvas_group_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_fill (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_group_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpCanvasGroupPrivate *private = GET_PRIVATE (item);
|
||||
GdkRegion *region = NULL;
|
||||
cairo_region_t *region = NULL;
|
||||
GList *list;
|
||||
|
||||
for (list = private->items; list; list = g_list_next (list))
|
||||
{
|
||||
GimpCanvasItem *sub_item = list->data;
|
||||
GdkRegion *sub_region = gimp_canvas_item_get_extents (sub_item);
|
||||
cairo_region_t *sub_region = gimp_canvas_item_get_extents (sub_item);
|
||||
|
||||
if (! region)
|
||||
{
|
||||
|
@ -217,8 +217,13 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
|
|||
}
|
||||
else if (sub_region)
|
||||
{
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union (region, sub_region);
|
||||
cairo_region_destroy (sub_region);
|
||||
#else
|
||||
gdk_region_union (region, sub_region);
|
||||
gdk_region_destroy (sub_region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +232,7 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
|
|||
|
||||
static void
|
||||
gimp_canvas_group_child_update (GimpCanvasItem *item,
|
||||
GdkRegion *region,
|
||||
cairo_region_t *region,
|
||||
GimpCanvasGroup *group)
|
||||
{
|
||||
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
||||
|
@ -269,12 +274,16 @@ gimp_canvas_group_add_item (GimpCanvasGroup *group,
|
|||
|
||||
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
||||
{
|
||||
GdkRegion *region = gimp_canvas_item_get_extents (item);
|
||||
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
||||
|
||||
if (region)
|
||||
{
|
||||
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_destroy (region);
|
||||
#else
|
||||
gdk_region_destroy (region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,12 +315,16 @@ gimp_canvas_group_remove_item (GimpCanvasGroup *group,
|
|||
|
||||
if (_gimp_canvas_item_needs_update (GIMP_CANVAS_ITEM (group)))
|
||||
{
|
||||
GdkRegion *region = gimp_canvas_item_get_extents (item);
|
||||
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
||||
|
||||
if (region)
|
||||
{
|
||||
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_destroy (region);
|
||||
#else
|
||||
gdk_region_destroy (region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,22 +60,22 @@ struct _GimpCanvasGuidePrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_guide_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_guide_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_guide_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_guide_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_guide_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_guide_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_guide_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_guide_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_guide_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_guide_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasGuide, gimp_canvas_guide, GIMP_TYPE_CANVAS_ITEM)
|
||||
|
@ -226,7 +226,7 @@ gimp_canvas_guide_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_guide_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -241,7 +241,11 @@ gimp_canvas_guide_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ABS (x2 - x1) + 3.0;
|
||||
rectangle.height = ABS (y2 - y1) + 3.0;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -71,19 +71,19 @@ struct _GimpCanvasHandlePrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_handle_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_handle_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_handle_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_handle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_handle_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_handle_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_handle_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_handle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasHandle, gimp_canvas_handle,
|
||||
|
@ -467,7 +467,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
|
|||
}
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_handle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -500,7 +500,11 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -61,7 +61,7 @@ struct _GimpCanvasItemPrivate
|
|||
gint suspend_stroking;
|
||||
gint suspend_filling;
|
||||
gint change_count;
|
||||
GdkRegion *change_region;
|
||||
cairo_region_t *change_region;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(item) \
|
||||
|
@ -72,31 +72,30 @@ struct _GimpCanvasItemPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_item_constructed (GObject *object);
|
||||
static void gimp_canvas_item_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_item_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void
|
||||
gimp_canvas_item_dispatch_properties_changed (GObject *object,
|
||||
guint n_pspecs,
|
||||
GParamSpec **pspecs);
|
||||
static void gimp_canvas_item_constructed (GObject *object);
|
||||
static void gimp_canvas_item_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_item_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_item_dispatch_properties_changed (GObject *object,
|
||||
guint n_pspecs,
|
||||
GParamSpec **pspecs);
|
||||
|
||||
static void gimp_canvas_item_real_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_item_real_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_item_real_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_item_real_fill (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_item_real_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_item_real_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_item_real_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_item_real_fill (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasItem, gimp_canvas_item,
|
||||
|
@ -262,13 +261,17 @@ gimp_canvas_item_dispatch_properties_changed (GObject *object,
|
|||
|
||||
if (_gimp_canvas_item_needs_update (item))
|
||||
{
|
||||
GdkRegion *region = gimp_canvas_item_get_extents (item);
|
||||
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
||||
|
||||
if (region)
|
||||
{
|
||||
g_signal_emit (object, item_signals[UPDATE], 0,
|
||||
region);
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_destroy (region);
|
||||
#else
|
||||
gdk_region_destroy (region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +284,7 @@ gimp_canvas_item_real_draw (GimpCanvasItem *item,
|
|||
g_warn_if_reached ();
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_item_real_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -341,7 +344,7 @@ gimp_canvas_item_draw (GimpCanvasItem *item,
|
|||
}
|
||||
}
|
||||
|
||||
GdkRegion *
|
||||
cairo_region_t *
|
||||
gimp_canvas_item_get_extents (GimpCanvasItem *item)
|
||||
{
|
||||
GimpCanvasItemPrivate *private;
|
||||
|
@ -473,7 +476,7 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
|
|||
{
|
||||
if (g_signal_has_handler_pending (item, item_signals[UPDATE], 0, FALSE))
|
||||
{
|
||||
GdkRegion *region = gimp_canvas_item_get_extents (item);
|
||||
cairo_region_t *region = gimp_canvas_item_get_extents (item);
|
||||
|
||||
if (! region)
|
||||
{
|
||||
|
@ -481,8 +484,13 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
|
|||
}
|
||||
else if (private->change_region)
|
||||
{
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union (region, private->change_region);
|
||||
cairo_region_destroy (private->change_region);
|
||||
#else
|
||||
gdk_region_union (region, private->change_region);
|
||||
gdk_region_destroy (private->change_region);
|
||||
#endif
|
||||
}
|
||||
|
||||
private->change_region = NULL;
|
||||
|
@ -491,12 +499,20 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
|
|||
{
|
||||
g_signal_emit (item, item_signals[UPDATE], 0,
|
||||
region);
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_destroy (region);
|
||||
#else
|
||||
gdk_region_destroy (region);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (private->change_region)
|
||||
{
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_destroy (private->change_region);
|
||||
#else
|
||||
gdk_region_destroy (private->change_region);
|
||||
#endif
|
||||
private->change_region = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +575,7 @@ gimp_canvas_item_resume_filling (GimpCanvasItem *item)
|
|||
|
||||
void
|
||||
_gimp_canvas_item_update (GimpCanvasItem *item,
|
||||
GdkRegion *region)
|
||||
cairo_region_t *region)
|
||||
{
|
||||
g_signal_emit (item, item_signals[UPDATE], 0,
|
||||
region);
|
||||
|
|
|
@ -45,61 +45,61 @@ struct _GimpCanvasItemClass
|
|||
GimpObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* update) (GimpCanvasItem *item,
|
||||
GdkRegion *region);
|
||||
void (* update) (GimpCanvasItem *item,
|
||||
cairo_region_t *region);
|
||||
|
||||
/* virtual functions */
|
||||
void (* draw) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
GdkRegion * (* get_extents) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
void (* draw) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
cairo_region_t * (* get_extents) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
void (* stroke) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
void (* fill) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
void (* stroke) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
void (* fill) (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_canvas_item_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_canvas_item_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_canvas_item_draw (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
GdkRegion * gimp_canvas_item_get_extents (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_draw (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
cairo_region_t * gimp_canvas_item_get_extents (GimpCanvasItem *item);
|
||||
|
||||
void gimp_canvas_item_set_visible (GimpCanvasItem *item,
|
||||
gboolean visible);
|
||||
gboolean gimp_canvas_item_get_visible (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_set_visible (GimpCanvasItem *item,
|
||||
gboolean visible);
|
||||
gboolean gimp_canvas_item_get_visible (GimpCanvasItem *item);
|
||||
|
||||
void gimp_canvas_item_set_line_cap (GimpCanvasItem *item,
|
||||
cairo_line_cap_t line_cap);
|
||||
void gimp_canvas_item_set_line_cap (GimpCanvasItem *item,
|
||||
cairo_line_cap_t line_cap);
|
||||
|
||||
void gimp_canvas_item_set_highlight (GimpCanvasItem *item,
|
||||
gboolean highlight);
|
||||
gboolean gimp_canvas_item_get_highlight (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_set_highlight (GimpCanvasItem *item,
|
||||
gboolean highlight);
|
||||
gboolean gimp_canvas_item_get_highlight (GimpCanvasItem *item);
|
||||
|
||||
void gimp_canvas_item_begin_change (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_end_change (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_begin_change (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_end_change (GimpCanvasItem *item);
|
||||
|
||||
void gimp_canvas_item_suspend_stroking (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_resume_stroking (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_suspend_stroking (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_resume_stroking (GimpCanvasItem *item);
|
||||
|
||||
void gimp_canvas_item_suspend_filling (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_resume_filling (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_suspend_filling (GimpCanvasItem *item);
|
||||
void gimp_canvas_item_resume_filling (GimpCanvasItem *item);
|
||||
|
||||
|
||||
/* protected */
|
||||
|
||||
void _gimp_canvas_item_update (GimpCanvasItem *item,
|
||||
GdkRegion *region);
|
||||
gboolean _gimp_canvas_item_needs_update (GimpCanvasItem *item);
|
||||
void _gimp_canvas_item_stroke (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
void _gimp_canvas_item_fill (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
void _gimp_canvas_item_update (GimpCanvasItem *item,
|
||||
cairo_region_t *region);
|
||||
gboolean _gimp_canvas_item_needs_update (GimpCanvasItem *item);
|
||||
void _gimp_canvas_item_stroke (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
void _gimp_canvas_item_fill (GimpCanvasItem *item,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
#endif /* __GIMP_CANVAS_ITEM_H__ */
|
||||
|
|
|
@ -64,22 +64,22 @@ struct _GimpCanvasLayerBoundaryPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_layer_boundary_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_layer_boundary_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_layer_boundary_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_layer_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_layer_boundary_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_layer_boundary_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_layer_boundary_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_layer_boundary_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_layer_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_layer_boundary_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasLayerBoundary, gimp_canvas_layer_boundary,
|
||||
|
@ -176,7 +176,7 @@ gimp_canvas_layer_boundary_draw (GimpCanvasItem *item,
|
|||
GIMP_CANVAS_ITEM_CLASS (parent_class)->draw (item, shell, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_layer_boundary_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
|
|
@ -61,19 +61,19 @@ struct _GimpCanvasLinePrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_line_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_line_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_line_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_line_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_line_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_line_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_line_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_line_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasLine, gimp_canvas_line, GIMP_TYPE_CANVAS_ITEM)
|
||||
|
@ -222,7 +222,7 @@ gimp_canvas_line_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_line_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -247,7 +247,11 @@ gimp_canvas_line_get_extents (GimpCanvasItem *item,
|
|||
rectangle.height = ceil (ABS (y2 - y1) + 5.0);
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -64,23 +64,23 @@ struct _GimpCanvasPathPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_path_finalize (GObject *object);
|
||||
static void gimp_canvas_path_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_path_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_path_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_path_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_path_finalize (GObject *object);
|
||||
static void gimp_canvas_path_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_path_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_path_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_path_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasPath, gimp_canvas_path,
|
||||
|
@ -218,7 +218,7 @@ gimp_canvas_path_draw (GimpCanvasItem *item,
|
|||
}
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -258,7 +258,11 @@ gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
|||
rectangle.height = ceil (y2 + 1.5) - rectangle.y;
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -62,19 +62,19 @@ struct _GimpCanvasPenPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_pen_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_pen_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static GdkRegion * gimp_canvas_pen_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_pen_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_pen_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_pen_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static cairo_region_t * gimp_canvas_pen_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_pen_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasPen, gimp_canvas_pen,
|
||||
|
@ -159,12 +159,12 @@ gimp_canvas_pen_get_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_pen_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpCanvasPenPrivate *private = GET_PRIVATE (item);
|
||||
GdkRegion *region;
|
||||
cairo_region_t *region;
|
||||
|
||||
region = GIMP_CANVAS_ITEM_CLASS (parent_class)->get_extents (item, shell);
|
||||
|
||||
|
@ -172,14 +172,22 @@ gimp_canvas_pen_get_extents (GimpCanvasItem *item,
|
|||
{
|
||||
GdkRectangle rectangle;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_get_extents (region, (cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
gdk_region_get_clipbox (region, &rectangle);
|
||||
#endif
|
||||
|
||||
rectangle.x -= ceil (private->width / 2.0);
|
||||
rectangle.y -= ceil (private->width / 2.0);
|
||||
rectangle.width += private->width + 1;
|
||||
rectangle.height += private->width + 1;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
gdk_region_union_with_rect (region, &rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
return region;
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -63,19 +63,19 @@ struct _GimpCanvasRectanglePrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_rectangle_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_rectangle_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_rectangle_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_rectangle_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_rectangle_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_rectangle_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasRectangle, gimp_canvas_rectangle,
|
||||
|
@ -258,7 +258,7 @@ gimp_canvas_rectangle_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -276,11 +276,15 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (w + 2.0);
|
||||
rectangle.height = ceil (h + 2.0);
|
||||
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
else if (w > 64 && h > 64)
|
||||
{
|
||||
GdkRegion *region;
|
||||
cairo_region_t *region;
|
||||
|
||||
/* left */
|
||||
rectangle.x = floor (x - 1.5);
|
||||
|
@ -288,12 +292,20 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = 3.0;
|
||||
rectangle.height = ceil (h + 3.0);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
region = gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
|
||||
/* right */
|
||||
rectangle.x = floor (x + w - 1.5);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
gdk_region_union_with_rect (region, &rectangle);
|
||||
#endif
|
||||
|
||||
/* top */
|
||||
rectangle.x = floor (x - 1.5);
|
||||
|
@ -301,12 +313,20 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (w + 3.0);
|
||||
rectangle.height = 3.0;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
gdk_region_union_with_rect (region, &rectangle);
|
||||
#endif
|
||||
|
||||
/* bottom */
|
||||
rectangle.y = floor (y + h - 1.5);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
gdk_region_union_with_rect (region, &rectangle);
|
||||
#endif
|
||||
|
||||
return region;
|
||||
}
|
||||
|
@ -317,7 +337,11 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width = ceil (w + 3.0);
|
||||
rectangle.height = ceil (h + 3.0);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,25 +66,25 @@ struct _GimpCanvasSamplePointPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_sample_point_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_sample_point_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_sample_point_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_sample_point_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_sample_point_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_sample_point_fill (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_sample_point_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_sample_point_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_sample_point_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_sample_point_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_sample_point_stroke (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static void gimp_canvas_sample_point_fill (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasSamplePoint, gimp_canvas_sample_point,
|
||||
|
@ -257,7 +257,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_fill (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_sample_point_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -281,7 +281,11 @@ gimp_canvas_sample_point_get_extents (GimpCanvasItem *item,
|
|||
rectangle.width += 5;
|
||||
rectangle.height += 5;
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -63,19 +63,19 @@ struct _GimpCanvasTextCursorPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_text_cursor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_text_cursor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_text_cursor_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static GdkRegion * gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_canvas_text_cursor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_text_cursor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_canvas_text_cursor_draw (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell,
|
||||
cairo_t *cr);
|
||||
static cairo_region_t * gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpCanvasTextCursor, gimp_canvas_text_cursor,
|
||||
|
@ -268,7 +268,7 @@ gimp_canvas_text_cursor_draw (GimpCanvasItem *item,
|
|||
_gimp_canvas_item_stroke (item, cr);
|
||||
}
|
||||
|
||||
static GdkRegion *
|
||||
static cairo_region_t *
|
||||
gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -294,7 +294,11 @@ gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
|
|||
rectangle.height = ceil (h + 3.0);
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
|
||||
#else
|
||||
return gdk_region_rectangle (&rectangle);
|
||||
#endif
|
||||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
|
|
|
@ -46,13 +46,36 @@ gimp_display_shell_expose_area (GimpDisplayShell *shell,
|
|||
|
||||
void
|
||||
gimp_display_shell_expose_region (GimpDisplayShell *shell,
|
||||
GdkRegion *region)
|
||||
cairo_region_t *region)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
{
|
||||
GdkRegion *gdk_region = gdk_region_new ();
|
||||
gint n_rectangles;
|
||||
gint i;
|
||||
|
||||
n_rectangles = cairo_region_num_rectangles (region);
|
||||
|
||||
for (i = 0; i < n_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rectangle;
|
||||
|
||||
cairo_region_get_rectangle (region, i, &rectangle);
|
||||
|
||||
gdk_region_union_with_rect (gdk_region, (GdkRectangle *) &rectangle);
|
||||
}
|
||||
|
||||
gdk_window_invalidate_region (gtk_widget_get_window (shell->canvas),
|
||||
gdk_region, TRUE);
|
||||
gdk_region_destroy (gdk_region);
|
||||
}
|
||||
#else
|
||||
gdk_window_invalidate_region (gtk_widget_get_window (shell->canvas),
|
||||
region, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -25,7 +25,7 @@ void gimp_display_shell_expose_area (GimpDisplayShell *shell,
|
|||
gint w,
|
||||
gint h);
|
||||
void gimp_display_shell_expose_region (GimpDisplayShell *shell,
|
||||
GdkRegion *region);
|
||||
cairo_region_t *region);
|
||||
void gimp_display_shell_expose_vectors (GimpDisplayShell *shell,
|
||||
GimpVectors *vectors);
|
||||
void gimp_display_shell_expose_full (GimpDisplayShell *shell);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_shell_item_update (GimpCanvasItem *item,
|
||||
GdkRegion *region,
|
||||
cairo_region_t *region,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
|
@ -129,7 +129,7 @@ gimp_display_shell_remove_item (GimpDisplayShell *shell,
|
|||
|
||||
static void
|
||||
gimp_display_shell_item_update (GimpCanvasItem *item,
|
||||
GdkRegion *region,
|
||||
cairo_region_t *region,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_display_shell_expose_region (shell, region);
|
||||
|
|
Loading…
Reference in New Issue