Deprecate the GdkRegion API

Includes fixing all callers to use the cairo region API instead. This is
usually just replacing the function names, the only difference is
gdk_region_get_rectangles() being replaced by
cairo_region_num_rectangles() and cairo_region_get_rectangle() which
required a bit more work.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
This commit is contained in:
Benjamin Otte 2010-06-28 14:44:12 +02:00
parent 52200eee01
commit 3e96cfe8fc
32 changed files with 644 additions and 596 deletions

View File

@ -47,15 +47,12 @@ Defines the x and y coordinates of a point.
@x: the x coordinate of the point.
@y: the y coordinate of the point.
<!-- ##### STRUCT GdkRectangle ##### -->
<!-- ##### TYPEDEF GdkRectangle ##### -->
<para>
Defines the position and size of a rectangle.
Defines the position and size of a rectangle. It is identical to
#cairo_rectangle_int_t.
</para>
@x: the x coordinate of the left edge of the rectangle.
@y: the y coordinate of the top of the rectangle.
@width: the width of the rectangle.
@height: the height of the rectangle.
<!-- ##### FUNCTION gdk_rectangle_intersect ##### -->
<para>

View File

@ -258,7 +258,7 @@ gdk_directfb_clip_region (GdkDrawable *drawable,
GDKDFB_RECTANGLE_VALS_FROM_BOX( &private->paint_region.extents ),
private->paint_region.numRects );
gdk_region_intersect (ret_clip, &private->paint_region);
cairo_region_intersect (ret_clip, &private->paint_region);
}
if (gc)
@ -273,13 +273,13 @@ gdk_directfb_clip_region (GdkDrawable *drawable,
if (gc->clip_x_origin || gc->clip_y_origin)
{
gdk_region_offset (ret_clip, -gc->clip_x_origin, -gc->clip_y_origin);
gdk_region_intersect (ret_clip, region);
gdk_region_offset (ret_clip, gc->clip_x_origin, gc->clip_y_origin);
cairo_region_translate (ret_clip, -gc->clip_x_origin, -gc->clip_y_origin);
cairo_region_intersect (ret_clip, region);
cairo_region_translate (ret_clip, gc->clip_x_origin, gc->clip_y_origin);
}
else
{
gdk_region_intersect (ret_clip, region);
cairo_region_intersect (ret_clip, region);
}
}
@ -327,7 +327,7 @@ gdk_directfb_clip_region (GdkDrawable *drawable,
D_DEBUG_AT( GDKDFB_DrawClip, " -> clipping child [ %4d,%4d - %4dx%4d ] (%ld boxes)\n",
GDKDFB_RECTANGLE_VALS_FROM_BOX( &temp.extents ), temp.numRects );
gdk_region_subtract (ret_clip, &temp);
cairo_region_subtract (ret_clip, &temp);
}
}
@ -739,7 +739,7 @@ gdk_directfb_draw_points (GdkDrawable *drawable,
while (npoints > 0)
{
if (gdk_region_point_in (&clip, points->x, points->y))
if (cairo_region_contains_point (&clip, points->x, points->y))
{
impl->surface->FillRectangle (impl->surface,
points->x, points->y, 1, 1);
@ -940,7 +940,7 @@ gdk_directfb_draw_image (GdkDrawable *drawable,
gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
if (!gdk_region_empty (&clip))
if (!cairo_region_is_empty (&clip))
{
DFBRectangle src_rect = { xsrc, ysrc, width, height };
@ -1218,15 +1218,15 @@ gdk_directfb_draw_pixbuf (GdkDrawable *drawable,
tmp_rect.width = width;
tmp_rect.height = height;
drect = gdk_region_rectangle (&tmp_rect);
drect = cairo_region_create_rectangle (&tmp_rect);
clip = gdk_drawable_get_clip_region (drawable);
gdk_region_intersect (drect, clip);
cairo_region_intersect (drect, clip);
gdk_region_get_clipbox (drect, &tmp_rect);
cairo_region_get_extents (drect, &tmp_rect);
gdk_region_destroy (drect);
gdk_region_destroy (clip);
cairo_region_destroy (drect);
cairo_region_destroy (clip);
if (tmp_rect.width == 0 ||
tmp_rect.height == 0)

View File

@ -91,24 +91,24 @@ _gdk_directfb_window_scroll (GdkWindow *window,
/* Move the current invalid region */
if (private->update_area)
gdk_region_offset (private->update_area, dx, dy);
cairo_region_translate (private->update_area, dx, dy);
if (GDK_WINDOW_IS_MAPPED (window))
{
GdkRectangle clip_rect = { 0, 0, impl->width, impl->height };
GdkRectangle rect = { dx, dy, impl->width, impl->height };
invalidate_region = gdk_region_rectangle (&clip_rect);
invalidate_region = cairo_region_create_rectangle (&clip_rect);
if (gdk_rectangle_intersect (&rect, &clip_rect, &rect) &&
(!private->update_area ||
!gdk_region_rect_in (private->update_area, &rect)))
!cairo_region_contains_rectangle (private->update_area, &rect)))
{
GdkRegion *region;
region = gdk_region_rectangle (&rect);
gdk_region_subtract (invalidate_region, region);
gdk_region_destroy (region);
region = cairo_region_create_rectangle (&rect);
cairo_region_subtract (invalidate_region, region);
cairo_region_destroy (region);
if (impl->surface)
{
@ -141,7 +141,7 @@ _gdk_directfb_window_scroll (GdkWindow *window,
if (invalidate_region)
{
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
cairo_region_destroy (invalidate_region);
}
}
@ -188,31 +188,31 @@ _gdk_directfb_window_move_region (GdkWindow *window,
return;
GdkRectangle clip_rect = { 0, 0, impl->width, impl->height };
window_clip = gdk_region_rectangle (&clip_rect);
window_clip = cairo_region_create_rectangle (&clip_rect);
/* compute source regions */
src_region = gdk_region_copy (region);
brought_in = gdk_region_copy (region);
gdk_region_intersect (src_region, window_clip);
src_region = cairo_region_copy (region);
brought_in = cairo_region_copy (region);
cairo_region_intersect (src_region, window_clip);
gdk_region_subtract (brought_in, src_region);
gdk_region_offset (brought_in, dx, dy);
cairo_region_subtract (brought_in, src_region);
cairo_region_translate (brought_in, dx, dy);
/* compute destination regions */
dest_region = gdk_region_copy (src_region);
gdk_region_offset (dest_region, dx, dy);
gdk_region_intersect (dest_region, window_clip);
gdk_region_get_clipbox (dest_region, &dest_extents);
dest_region = cairo_region_copy (src_region);
cairo_region_translate (dest_region, dx, dy);
cairo_region_intersect (dest_region, window_clip);
cairo_region_get_extents (dest_region, &dest_extents);
gdk_region_destroy (window_clip);
cairo_region_destroy (window_clip);
/* calculating moving part of current invalid area */
moving_invalid_region = NULL;
if (private->update_area)
{
moving_invalid_region = gdk_region_copy (private->update_area);
gdk_region_intersect (moving_invalid_region, src_region);
gdk_region_offset (moving_invalid_region, dx, dy);
moving_invalid_region = cairo_region_copy (private->update_area);
cairo_region_intersect (moving_invalid_region, src_region);
cairo_region_translate (moving_invalid_region, dx, dy);
}
/* invalidate all of the src region */
@ -220,18 +220,18 @@ _gdk_directfb_window_move_region (GdkWindow *window,
/* un-invalidate destination region */
if (private->update_area)
gdk_region_subtract (private->update_area, dest_region);
cairo_region_subtract (private->update_area, dest_region);
/* invalidate moving parts of existing update area */
if (moving_invalid_region)
{
gdk_window_invalidate_region (window, moving_invalid_region, FALSE);
gdk_region_destroy (moving_invalid_region);
cairo_region_destroy (moving_invalid_region);
}
/* invalidate area brought in from off-screen */
gdk_window_invalidate_region (window, brought_in, FALSE);
gdk_region_destroy (brought_in);
cairo_region_destroy (brought_in);
/* Actually do the moving */
if (impl->surface)
@ -250,8 +250,8 @@ _gdk_directfb_window_move_region (GdkWindow *window,
impl->surface->SetClip (impl->surface, NULL);
impl->surface->Flip(impl->surface,&destination,0);
}
gdk_region_destroy (src_region);
gdk_region_destroy (dest_region);
cairo_region_destroy (src_region);
cairo_region_destroy (dest_region);
}
#define __GDK_GEOMETRY_X11_C__

View File

@ -227,7 +227,7 @@ gdk_window_impl_directfb_get_visible_region (GdkDrawable *drawable)
D_DEBUG_AT( GDKDFB_Window, " -> returning %4d,%4d-%4dx%4d\n", drect.x, drect.y, drect.w, drect.h );
return gdk_region_rectangle (&rect);
return cairo_region_create_rectangle (&rect);
}
static void
@ -2648,7 +2648,7 @@ gdk_window_impl_directfb_begin_paint_region (GdkPaintable *paintable,
DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
/* Add the new region to the paint region... */
gdk_region_union (&impl->paint_region, region);
cairo_region_union (&impl->paint_region, region);
}
else
{
@ -2668,7 +2668,7 @@ gdk_window_impl_directfb_begin_paint_region (GdkPaintable *paintable,
DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
/* ...but clip the initial/compound result against the clip region. */
gdk_region_intersect (&impl->paint_region, &impl->clip_region);
cairo_region_intersect (&impl->paint_region, &impl->clip_region);
D_DEBUG_AT( GDKDFB_Window, " -> clipped %4d,%4d-%4dx%4d (%ld boxes)\n",
DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );

View File

@ -977,6 +977,7 @@ gdk_pixmap_lookup_for_display
#if IN_HEADER(__GDK_REGION_H__)
#if IN_FILE(__GDK_REGION_GENERIC_C__)
#ifndef GDK_DISABLE_DEPRECATED
gdk_region_copy
gdk_region_destroy
gdk_region_empty
@ -998,12 +999,15 @@ gdk_region_union_with_rect
gdk_region_xor
#endif
#endif
#endif
#if IN_HEADER(__GDK_REGION_H__)
#if IN_FILE(__GDK_POLYREG_GENERIC_C__)
#ifndef GDK_DISABLE_DEPRECATED
gdk_region_polygon
#endif
#endif
#endif
#if IN_HEADER(__GDK_RGB_H__)
#if IN_FILE(__GDK_RGB_C__)

View File

@ -1059,7 +1059,7 @@ gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
* but no area outside of this region will be affected by drawing
* primitives.
*
* Returns: a #GdkRegion. This must be freed with gdk_region_destroy()
* Returns: a #GdkRegion. This must be freed with cairo_region_destroy()
* when you are done.
**/
GdkRegion *
@ -1079,7 +1079,7 @@ gdk_drawable_get_clip_region (GdkDrawable *drawable)
* obscured by other windows, but no area outside of this region
* is visible.
*
* Returns: a #GdkRegion. This must be freed with gdk_region_destroy()
* Returns: a #GdkRegion. This must be freed with cairo_region_destroy()
* when you are done.
**/
GdkRegion *
@ -1100,7 +1100,7 @@ gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
gdk_drawable_get_size (drawable, &rect.width, &rect.height);
return gdk_region_rectangle (&rect);
return cairo_region_create_rectangle (&rect);
}
/**
@ -1431,15 +1431,15 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
tmp_rect.width = width;
tmp_rect.height = height;
drect = gdk_region_rectangle (&tmp_rect);
drect = cairo_region_create_rectangle (&tmp_rect);
clip = gdk_drawable_get_clip_region (drawable);
gdk_region_intersect (drect, clip);
cairo_region_intersect (drect, clip);
gdk_region_get_clipbox (drect, &tmp_rect);
cairo_region_get_extents (drect, &tmp_rect);
gdk_region_destroy (drect);
gdk_region_destroy (clip);
cairo_region_destroy (drect);
cairo_region_destroy (clip);
if (tmp_rect.width == 0 ||
tmp_rect.height == 0)

View File

@ -473,7 +473,7 @@ gdk_event_copy (const GdkEvent *event)
case GDK_EXPOSE:
case GDK_DAMAGE:
if (event->expose.region)
new_event->expose.region = gdk_region_copy (event->expose.region);
new_event->expose.region = cairo_region_copy (event->expose.region);
break;
case GDK_SETTING:
@ -551,7 +551,7 @@ gdk_event_free (GdkEvent *event)
case GDK_EXPOSE:
case GDK_DAMAGE:
if (event->expose.region)
gdk_region_destroy (event->expose.region);
cairo_region_destroy (event->expose.region);
break;
case GDK_MOTION_NOTIFY:

View File

@ -205,9 +205,9 @@ gdk_gc_finalize (GObject *object)
GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
if (priv->clip_region)
gdk_region_destroy (priv->clip_region);
cairo_region_destroy (priv->clip_region);
if (priv->old_clip_region)
gdk_region_destroy (priv->old_clip_region);
cairo_region_destroy (priv->old_clip_region);
if (priv->clip_mask)
g_object_unref (priv->clip_mask);
if (priv->old_clip_mask)
@ -293,7 +293,7 @@ gdk_gc_set_values (GdkGC *gc,
if (priv->clip_region)
{
gdk_region_destroy (priv->clip_region);
cairo_region_destroy (priv->clip_region);
priv->clip_region = NULL;
}
}
@ -550,7 +550,7 @@ _gdk_gc_set_clip_region_real (GdkGC *gc,
}
if (priv->clip_region)
gdk_region_destroy (priv->clip_region);
cairo_region_destroy (priv->clip_region);
priv->clip_region = region;
@ -585,9 +585,9 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
if (priv->region_tag_applied)
_gdk_gc_remove_drawable_clip (gc);
region = gdk_region_copy (region);
region = cairo_region_copy (region);
if (offset_x != 0 || offset_y != 0)
gdk_region_offset (region, offset_x, offset_y);
cairo_region_translate (region, offset_x, offset_y);
if (priv->clip_mask)
{
@ -596,7 +596,7 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
GdkGC *tmp_gc;
GdkColor black = {0, 0, 0, 0};
GdkRectangle r;
GdkOverlapType overlap;
cairo_region_overlap_t overlap;
gdk_drawable_get_size (priv->clip_mask, &w, &h);
@ -609,8 +609,8 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
* the region, so we try to avoid allocating bitmaps that are just fully
* set or completely unset.
*/
overlap = gdk_region_rect_in (region, &r);
if (overlap == GDK_OVERLAP_RECTANGLE_PART)
overlap = cairo_region_contains_rectangle (region, &r);
if (overlap == CAIRO_REGION_OVERLAP_PART)
{
/* The region and the mask intersect, create a new clip mask that
includes both areas */
@ -631,12 +631,12 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
gdk_gc_set_clip_mask (gc, new_mask);
g_object_unref (new_mask);
}
else if (overlap == GDK_OVERLAP_RECTANGLE_OUT)
else if (overlap == CAIRO_REGION_OVERLAP_OUT)
{
/* No intersection, set empty clip region */
GdkRegion *empty = gdk_region_new ();
GdkRegion *empty = cairo_region_create ();
gdk_region_destroy (region);
cairo_region_destroy (region);
priv->old_clip_mask = g_object_ref (priv->clip_mask);
priv->clip_region = empty;
_gdk_windowing_gc_set_clip_region (gc, empty, FALSE);
@ -644,7 +644,7 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
else
{
/* Completely inside region, don't set unnecessary clip */
gdk_region_destroy (region);
cairo_region_destroy (region);
return;
}
}
@ -653,7 +653,7 @@ _gdk_gc_add_drawable_clip (GdkGC *gc,
priv->old_clip_region = priv->clip_region;
priv->clip_region = region;
if (priv->old_clip_region)
gdk_region_intersect (region, priv->old_clip_region);
cairo_region_intersect (region, priv->old_clip_region);
_gdk_windowing_gc_set_clip_region (gc, priv->clip_region, FALSE);
}
@ -711,7 +711,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
_gdk_gc_remove_drawable_clip (gc);
if (rectangle)
region = gdk_region_rectangle (rectangle);
region = cairo_region_create_rectangle (rectangle);
else
region = NULL;
@ -738,7 +738,7 @@ gdk_gc_set_clip_region (GdkGC *gc,
_gdk_gc_remove_drawable_clip (gc);
if (region)
copy = gdk_region_copy (region);
copy = cairo_region_copy (region);
else
copy = NULL;
@ -1063,20 +1063,20 @@ gdk_gc_copy (GdkGC *dst_gc,
dst_gc->colormap = src_gc->colormap;
if (dst_priv->clip_region)
gdk_region_destroy (dst_priv->clip_region);
cairo_region_destroy (dst_priv->clip_region);
if (src_priv->clip_region)
dst_priv->clip_region = gdk_region_copy (src_priv->clip_region);
dst_priv->clip_region = cairo_region_copy (src_priv->clip_region);
else
dst_priv->clip_region = NULL;
dst_priv->region_tag_applied = src_priv->region_tag_applied;
if (dst_priv->old_clip_region)
gdk_region_destroy (dst_priv->old_clip_region);
cairo_region_destroy (dst_priv->old_clip_region);
if (src_priv->old_clip_region)
dst_priv->old_clip_region = gdk_region_copy (src_priv->old_clip_region);
dst_priv->old_clip_region = cairo_region_copy (src_priv->old_clip_region);
else
dst_priv->old_clip_region = NULL;

View File

@ -288,9 +288,9 @@ add_damage (GdkOffscreenWindow *offscreen,
rect.height += 7;
}
damage = gdk_region_rectangle (&rect);
damage = cairo_region_create_rectangle (&rect);
_gdk_window_add_damage (offscreen->wrapper, damage);
gdk_region_destroy (damage);
cairo_region_destroy (damage);
}
static GdkDrawable *

View File

@ -1255,7 +1255,7 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
line = pango_layout_iter_get_line_readonly (iter);
clip_region = gdk_region_new ();
clip_region = cairo_region_create ();
pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
baseline = pango_layout_iter_get_baseline (iter);
@ -1289,7 +1289,7 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
rect.width = PANGO_PIXELS (pixel_ranges[2*j + 1] - logical_rect.x) - x_off;
rect.height = PANGO_PIXELS (baseline - logical_rect.y + logical_rect.height) - y_off;
gdk_region_union_with_rect (clip_region, &rect);
cairo_region_union_rectangle (clip_region, &rect);
}
g_free (pixel_ranges);
@ -1380,7 +1380,7 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
g_return_val_if_fail (index_ranges != NULL, NULL);
clip_region = gdk_region_new ();
clip_region = cairo_region_create ();
iter = pango_layout_get_iter (layout);
@ -1399,8 +1399,8 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
index_ranges,
n_ranges);
gdk_region_union (clip_region, line_region);
gdk_region_destroy (line_region);
cairo_region_union (clip_region, line_region);
cairo_region_destroy (line_region);
}
while (pango_layout_iter_next_line (iter));

View File

@ -481,7 +481,7 @@ gdk_region_polygon (const GdkPoint *points,
extents.y = MIN(points[0].y, points[2].y);
extents.width = MAX(points[0].x, points[2].x) - extents.x;
extents.height = MAX(points[0].y, points[2].y) - extents.y;
return gdk_region_rectangle (&extents);
return cairo_region_create_rectangle (&extents);
}
pETEs = g_new (EdgeTableEntry, n_points);

View File

@ -10,6 +10,8 @@
* Creates a new empty #GdkRegion.
*
* Returns: a new empty #GdkRegion
*
* Deprecated: 2.22: Use cairo_region_create() instead.
*/
GdkRegion *
gdk_region_new (void)
@ -24,6 +26,8 @@ gdk_region_new (void)
* Creates a new region containing the area @rectangle.
*
* Return value: a new region
*
* Deprecated: 2.22: Use cairo_region_create_rectangle()
**/
GdkRegion *
gdk_region_rectangle (const GdkRectangle *rectangle)
@ -43,6 +47,8 @@ gdk_region_rectangle (const GdkRectangle *rectangle)
* Copies @region, creating an identical new region.
*
* Return value: a new region identical to @region
*
* Deprecated: 2.22: Use cairo_region_copy()
**/
GdkRegion *
gdk_region_copy (const GdkRegion *region)
@ -57,6 +63,7 @@ gdk_region_copy (const GdkRegion *region)
*
* Obtains the smallest rectangle which includes the entire #GdkRegion.
*
* Deprecated: 2.22: Use cairo_region_get_extents()
*/
void
gdk_region_get_clipbox (const GdkRegion *region,
@ -77,6 +84,8 @@ gdk_region_get_clipbox (const GdkRegion *region,
*
* Obtains the area covered by the region as a list of rectangles.
* The array returned in @rectangles must be freed with g_free().
*
* Deprecated: 2.22: Use cairo_region_num_rectangles() and cairo_region_get_rectangle() instead.
**/
void
gdk_region_get_rectangles (const GdkRegion *region,
@ -110,6 +119,8 @@ gdk_region_get_rectangles (const GdkRegion *region,
* Sets the area of @region to the union of the areas of @region and
* @rect. The resulting area is the set of pixels contained in
* either @region or @rect.
*
* Deprecated: 2.22: Use cairo_region_union_rectangle() instead.
**/
void
gdk_region_union_with_rect (GdkRegion *region,
@ -129,6 +140,8 @@ gdk_region_union_with_rect (GdkRegion *region,
* @region: a #GdkRegion
*
* Destroys a #GdkRegion.
*
* Deprecated: 2.22: Use cairo_region_destroy() instead.
*/
void
gdk_region_destroy (GdkRegion *region)
@ -146,6 +159,8 @@ gdk_region_destroy (GdkRegion *region)
* @dy: the distance to move the region vertically
*
* Moves a region the specified distance.
*
* Deprecated: 2.22: Use cairo_region_translate() instead.
*/
void
gdk_region_offset (GdkRegion *region,
@ -163,6 +178,8 @@ gdk_region_offset (GdkRegion *region,
*
* Resizes a region by the specified amount.
* Positive values shrink the region. Negative values expand it.
*
* Deprecated: 2.22: There is no replacement for this function.
*/
void
gdk_region_shrink (GdkRegion *region,
@ -198,6 +215,8 @@ gdk_region_shrink (GdkRegion *region,
* Sets the area of @source1 to the intersection of the areas of @source1
* and @source2. The resulting area is the set of pixels contained in
* both @source1 and @source2.
*
* Deprecated: 2.22: Use cairo_region_intersect() instead.
**/
void
gdk_region_intersect (GdkRegion *source1,
@ -217,6 +236,8 @@ gdk_region_intersect (GdkRegion *source1,
* Sets the area of @source1 to the union of the areas of @source1 and
* @source2. The resulting area is the set of pixels contained in
* either @source1 or @source2.
*
* Deprecated: 2.22: Use cairo_region_union() instead.
**/
void
gdk_region_union (GdkRegion *source1,
@ -235,6 +256,8 @@ gdk_region_union (GdkRegion *source1,
*
* Subtracts the area of @source2 from the area @source1. The resulting
* area is the set of pixels contained in @source1 but not in @source2.
*
* Deprecated: 2.22: Use cairo_region_subtract() instead.
**/
void
gdk_region_subtract (GdkRegion *source1,
@ -254,6 +277,10 @@ gdk_region_subtract (GdkRegion *source1,
* Sets the area of @source1 to the exclusive-OR of the areas of @source1
* and @source2. The resulting area is the set of pixels contained in one
* or the other of the two sources but not in both.
*
* Deprecated: 2.22: There is no replacement, but the function can be
* reimplemented using cairo_region_intersect() and
* cairo_region_subract() easily.
**/
void
gdk_region_xor (GdkRegion *source1,
@ -281,6 +308,8 @@ gdk_region_xor (GdkRegion *source1,
* Finds out if the #GdkRegion is empty.
*
* Returns: %TRUE if @region is empty.
*
* Deprecated: 2.22: Use cairo_region_is_empty() instead.
*/
gboolean
gdk_region_empty (const GdkRegion *region)
@ -298,6 +327,8 @@ gdk_region_empty (const GdkRegion *region)
* Finds out if the two regions are the same.
*
* Returns: %TRUE if @region1 and @region2 are equal.
*
* Deprecated: 2.22: Use cairo_region_equal() instead.
*/
gboolean
gdk_region_equal (const GdkRegion *region1,
@ -347,6 +378,8 @@ gdk_region_rect_equal (const GdkRegion *region,
* Finds out if a point is in a region.
*
* Returns: %TRUE if the point is in @region.
*
* Deprecated: 2.22: Use cairo_region_contains_point() instead.
*/
gboolean
gdk_region_point_in (const GdkRegion *region,
@ -368,6 +401,8 @@ gdk_region_point_in (const GdkRegion *region,
* Returns: %GDK_OVERLAP_RECTANGLE_IN, %GDK_OVERLAP_RECTANGLE_OUT, or
* %GDK_OVERLAP_RECTANGLE_PART, depending on whether the rectangle is inside,
* outside, or partly inside the #GdkRegion, respectively.
*
* Deprecated: 2.22: Use cairo_region_contains_rectangle() instead.
*/
GdkOverlapType
gdk_region_rect_in (const GdkRegion *region,
@ -445,6 +480,8 @@ gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
* @data: data to pass to @function
*
* Calls a function on each span in the intersection of @region and @spans.
*
* Deprecated: 2.22: There is no replacement.
*/
void
gdk_region_spans_intersect_foreach (GdkRegion *region,

View File

@ -45,10 +45,14 @@ typedef enum
GDK_WINDING_RULE
} GdkFillRule;
#ifndef GDK_DISABLE_DEPRECATED
/* Types of overlapping between a rectangle and a region
* GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
* GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
* GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
*
* Deprecated: 2.22: Superceded by #cairo_region_overlap_t and
* cairo_region_contains_rectangle().
*/
typedef enum
{
@ -61,9 +65,11 @@ typedef void (* GdkSpanFunc) (GdkSpan *span,
gpointer data);
GdkRegion * gdk_region_new (void);
#endif
GdkRegion * gdk_region_polygon (const GdkPoint *points,
gint n_points,
GdkFillRule fill_rule);
#ifndef GDK_DISABLE_DEPRECATED
GdkRegion * gdk_region_copy (const GdkRegion *region);
GdkRegion * gdk_region_rectangle (const GdkRectangle *rectangle);
void gdk_region_destroy (GdkRegion *region);
@ -77,8 +83,10 @@ void gdk_region_get_rectangles (const GdkRegion *region,
gboolean gdk_region_empty (const GdkRegion *region);
gboolean gdk_region_equal (const GdkRegion *region1,
const GdkRegion *region2);
#endif
gboolean gdk_region_rect_equal (const GdkRegion *region,
const GdkRectangle *rectangle);
#ifndef GDK_DISABLE_DEPRECATED
gboolean gdk_region_point_in (const GdkRegion *region,
int x,
int y);
@ -108,6 +116,7 @@ void gdk_region_spans_intersect_foreach (GdkRegion *region,
gboolean sorted,
GdkSpanFunc function,
gpointer data);
#endif
G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@
const NSRect *drawn_rects;
NSInteger count;
int i;
GdkRegion *region;
cairo_region_t *region;
if (GDK_WINDOW_DESTROYED (gdk_window))
return;
@ -89,12 +89,12 @@
/* Clear our own bookkeeping of regions that need display */
if (impl->needs_display_region)
{
gdk_region_destroy (impl->needs_display_region);
cairo_region_destroy (impl->needs_display_region);
impl->needs_display_region = NULL;
}
[self getRectsBeingDrawn:&drawn_rects count:&count];
region = gdk_region_new ();
region = cairo_region_create ();
for (i = 0; i < count; i++)
{
@ -102,15 +102,15 @@
gdk_rect.y = drawn_rects[i].origin.y;
gdk_rect.width = drawn_rects[i].size.width;
gdk_rect.height = drawn_rects[i].size.height;
gdk_region_union_with_rect (region, &gdk_rect);
cairo_region_union_rectangle (region, &gdk_rect);
}
impl->in_paint_rect_count++;
_gdk_window_process_updates_recurse (gdk_window, region);
impl->in_paint_rect_count--;
gdk_region_destroy (region);
cairo_region_destroy (region);
if (needsInvalidateShadow)
{

View File

@ -437,11 +437,11 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc,
{
CGRect rect;
CGRect *cg_rects;
GdkRectangle *rects;
cairo_region_t *region;
gint n_rects, i;
gdk_region_get_rectangles (_gdk_gc_get_clip_region (gc),
&rects, &n_rects);
region = _gdk_gc_get_clip_region (gc);
n_rects = cairo_region_num_rectangles (region);
if (n_rects == 1)
cg_rects = &rect;
@ -450,15 +450,16 @@ _gdk_quartz_gc_update_cg_context (GdkGC *gc,
for (i = 0; i < n_rects; i++)
{
cg_rects[i].origin.x = rects[i].x + gc->clip_x_origin;
cg_rects[i].origin.y = rects[i].y + gc->clip_y_origin;
cg_rects[i].size.width = rects[i].width;
cg_rects[i].size.height = rects[i].height;
cairo_rectangle_int_t cairo_rect;
cairo_region_get_rectangle (region, i, &cairo_rect);
cg_rects[i].origin.x = cairo_rect.x + gc->clip_x_origin;
cg_rects[i].origin.y = cairo_rect.y + gc->clip_y_origin;
cg_rects[i].size.width = cairo_rect.width;
cg_rects[i].size.height = cairo_rect.height;
}
CGContextClipToRects (context, cg_rects, n_rects);
g_free (rects);
if (cg_rects != &rect)
g_free (cg_rects);
}

View File

@ -34,7 +34,7 @@ _gdk_quartz_window_queue_translation (GdkWindow *window,
int i, n_rects;
GdkRegion *intersection;
GdkRectangle *rects;
GdkRectangle rect;
/* We will intersect the known region that needs display with the given
* area. This intersection will be translated by dx, dy. For the end
@ -44,17 +44,12 @@ _gdk_quartz_window_queue_translation (GdkWindow *window,
if (!impl->needs_display_region)
return;
intersection = gdk_region_copy (impl->needs_display_region);
gdk_region_intersect (intersection, area);
gdk_region_offset (intersection, dx, dy);
intersection = cairo_region_copy (impl->needs_display_region);
cairo_region_intersect (intersection, area);
cairo_region_translate (intersection, dx, dy);
gdk_region_get_rectangles (intersection, &rects, &n_rects);
for (i = 0; i < n_rects; i++)
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
g_free (rects);
gdk_region_destroy (intersection);
_gdk_quartz_window_set_needs_display_in_region (window, intersection);
cairo_region_destroy (intersection);
}
gboolean

View File

@ -157,8 +157,8 @@ void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
gint number);
void _gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window,
GdkRectangle *rect);
void _gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
GdkRegion *region);
void _gdk_quartz_window_update_position (GdkWindow *window);

View File

@ -112,28 +112,28 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
{
CGRect rect;
CGRect *cg_rects;
GdkRectangle *rects;
gint n_rects, i;
gdk_region_get_rectangles (window_impl->paint_clip_region,
&rects, &n_rects);
n_rects = cairo_region_num_rectangles (window_impl->paint_clip_region);
if (n_rects == 1)
cg_rects = &rect;
cg_rects = &rect;
else
cg_rects = g_new (CGRect, n_rects);
cg_rects = g_new (CGRect, n_rects);
for (i = 0; i < n_rects; i++)
{
cg_rects[i].origin.x = rects[i].x;
cg_rects[i].origin.y = rects[i].y;
cg_rects[i].size.width = rects[i].width;
cg_rects[i].size.height = rects[i].height;
}
{
cairo_rectangle_int_t cairo_rect;
cairo_region_get_rectangle (window_impl->paint_clip_region,
i, &cairo_rect);
cg_rects[i].origin.x = cairo_rect.x;
cg_rects[i].origin.y = cairo_rect.y;
cg_rects[i].size.width = cairo_rect.width;
cg_rects[i].size.height = cairo_rect.height;
}
CGContextClipToRects (cg_context, cg_rects, n_rects);
CGContextClipToRects (context, cg_rects, n_rects);
g_free (rects);
if (cg_rects != &rect)
g_free (cg_rects);
}
@ -195,7 +195,7 @@ gdk_window_impl_quartz_finalize (GObject *object)
check_grab_destroy (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper);
if (impl->paint_clip_region)
gdk_region_destroy (impl->paint_clip_region);
cairo_region_destroy (impl->paint_clip_region);
if (impl->transient_for)
g_object_unref (impl->transient_for);
@ -230,18 +230,17 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
GdkWindowObject *private = (GdkWindowObject*)window;
int n_rects;
GdkRectangle *rects = NULL;
GdkPixmap *bg_pixmap;
GdkRegion *clipped_and_offset_region;
gboolean free_clipped_and_offset_region = TRUE;
bg_pixmap = private->bg_pixmap;
clipped_and_offset_region = gdk_region_copy (region);
clipped_and_offset_region = cairo_region_copy (region);
gdk_region_intersect (clipped_and_offset_region,
cairo_region_intersect (clipped_and_offset_region,
private->clip_region_with_children);
gdk_region_offset (clipped_and_offset_region,
cairo_region_translate (clipped_and_offset_region,
private->abs_x, private->abs_y);
if (impl->begin_paint_count == 0)
@ -250,14 +249,14 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
free_clipped_and_offset_region = FALSE;
}
else
gdk_region_union (impl->paint_clip_region, clipped_and_offset_region);
cairo_region_union (impl->paint_clip_region, clipped_and_offset_region);
impl->begin_paint_count++;
if (bg_pixmap == GDK_NO_BG)
goto done;
gdk_region_get_rectangles (clipped_and_offset_region, &rects, &n_rects);
n_rects = cairo_region_num_rectangles (clipped_and_offset_region);
if (n_rects == 0)
goto done;
@ -276,9 +275,11 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (clipped_and_offset_region, i, &rect);
CGContextFillRect (cg_context,
CGRectMake (rects[i].x, rects[i].y,
rects[i].width, rects[i].height));
CGRectMake (rect.x, rect.y,
rect.width, rect.height));
}
gdk_quartz_drawable_release_context (GDK_DRAWABLE (impl), cg_context);
@ -288,6 +289,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
int x, y;
int x_offset, y_offset;
int width, height;
cairo_int_rectangle_t rect;
GdkGC *gc;
x_offset = y_offset = 0;
@ -320,14 +322,15 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
gdk_drawable_get_size (GDK_DRAWABLE (bg_pixmap), &width, &height);
x = -x_offset;
while (x < (rects[0].x + rects[0].width))
cairo_region_get_rectangle (clipped_and_offset_region, 0, &rect);
while (x < (rect.x + rect.width))
{
if (x + width >= rects[0].x)
if (x + width >= rect.x)
{
y = -y_offset;
while (y < (rects[0].y + rects[0].height))
while (y < (rect.y + rect.height))
{
if (y + height >= rects[0].y)
if (y + height >= rect.y)
gdk_draw_drawable (GDK_DRAWABLE (impl), gc, bg_pixmap, 0, 0, x, y, width, height);
y += height;
@ -341,8 +344,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
done:
if (free_clipped_and_offset_region)
gdk_region_destroy (clipped_and_offset_region);
g_free (rects);
cairo_region_destroy (clipped_and_offset_region);
}
static void
@ -354,38 +356,41 @@ gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
if (impl->begin_paint_count == 0)
{
gdk_region_destroy (impl->paint_clip_region);
cairo_region_destroy (impl->paint_clip_region);
impl->paint_clip_region = NULL;
}
}
void
_gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window,
GdkRectangle *rect)
_gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
GdkRegion *region)
{
GdkWindowObject *private;
GdkWindowImplQuartz *impl;
int i, n_rects;
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
if (!impl->needs_display_region)
impl->needs_display_region = gdk_region_new ();
impl->needs_display_region = cairo_region_create ();
gdk_region_union_with_rect (impl->needs_display_region, rect);
[impl->view setNeedsDisplayInRect:NSMakeRect (rect->x, rect->y,
rect->width, rect->height)];
cairo_region_union (impl->needs_display_region, region);
n_rects = cairo_region_num_rectangles (region);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (region, i, &rect);
[impl->view setNeedsDisplayInRect:NSMakeRect (rect.x, rect.y,
rect.width, rect.height)];
}
}
void
_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
GdkRegion *region)
{
int i, n_rects;
GdkRectangle *rects;
/* Make sure to only flush each toplevel at most once if we're called
* from process_all_updates.
*/
@ -416,12 +421,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
}
}
gdk_region_get_rectangles (region, &rects, &n_rects);
for (i = 0; i < n_rects; i++)
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
g_free (rects);
_gdk_quartz_window_set_needs_display_in_region (window, region);
/* NOTE: I'm not sure if we should displayIfNeeded here. It slows down a
* lot (since it triggers the beam syncing) and things seem to work
@ -1410,9 +1410,9 @@ move_resize_window_internal (GdkWindow *window,
new_visible.width = old_visible.width; /* parent has not changed size */
new_visible.height = old_visible.height; /* parent has not changed size */
expose_region = gdk_region_rectangle (&new_visible);
old_region = gdk_region_rectangle (&old_visible);
gdk_region_subtract (expose_region, old_region);
expose_region = cairo_region_create_rectangle (&new_visible);
old_region = cairo_region_create_rectangle (&old_visible);
cairo_region_subtract (expose_region, old_region);
/* Determine what (if any) part of the previously visible
* part of the window can be copied without a redraw
@ -1422,12 +1422,8 @@ move_resize_window_internal (GdkWindow *window,
scroll_rect.y -= delta.height;
gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
if (!gdk_region_empty (expose_region))
if (!cairo_region_is_empty (expose_region))
{
GdkRectangle* rects;
gint n_rects;
gint n;
if (scroll_rect.width != 0 && scroll_rect.height != 0)
{
[impl->view scrollRect:NSMakeRect (scroll_rect.x,
@ -1439,12 +1435,7 @@ move_resize_window_internal (GdkWindow *window,
[impl->view setFrame:nsrect];
gdk_region_get_rectangles (expose_region, &rects, &n_rects);
for (n = 0; n < n_rects; ++n)
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[n]);
g_free (rects);
_gdk_quartz_window_set_needs_display_in_region (window, expose_region);
}
else
{
@ -1452,8 +1443,8 @@ move_resize_window_internal (GdkWindow *window,
[impl->view setNeedsDisplay:YES];
}
gdk_region_destroy (expose_region);
gdk_region_destroy (old_region);
cairo_region_destroy (expose_region);
cairo_region_destroy (old_region);
}
}

View File

@ -721,7 +721,7 @@ widen_bounds (GdkRectangle *bounds,
bounds->width += 2 * pen_width;
bounds->height += 2 * pen_width;
return gdk_region_rectangle (bounds);
return cairo_region_create_rectangle (bounds);
}
static void
@ -799,7 +799,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
(filled ? 0 : LINE_ATTRIBUTES),
draw_rectangle, region, filled, x, y, width, height);
gdk_region_destroy (region);
cairo_region_destroy (region);
}
static void
@ -897,7 +897,7 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
draw_arc, region, filled, x, y, width, height, angle1, angle2);
gdk_region_destroy (region);
cairo_region_destroy (region);
}
static void
@ -981,7 +981,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
draw_polygon, region, filled, pts, npoints);
gdk_region_destroy (region);
cairo_region_destroy (region);
g_free (pts);
}
@ -1152,7 +1152,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
generic_draw (drawable, gc, GDK_GC_FOREGROUND | LINE_ATTRIBUTES,
draw_segments, region, segs, nsegs);
gdk_region_destroy (region);
cairo_region_destroy (region);
}
static void
@ -1254,7 +1254,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
LINE_ATTRIBUTES,
draw_lines, region, pts, npoints);
gdk_region_destroy (region);
cairo_region_destroy (region);
g_free (pts);
}

View File

@ -1249,7 +1249,7 @@ synthesize_expose_events (GdkWindow *window)
event->expose.area.y = r.top;
event->expose.area.width = r.right - r.left;
event->expose.area.height = r.bottom - r.top;
event->expose.region = gdk_region_rectangle (&(event->expose.area));
event->expose.region = cairo_region_create_rectangle (&(event->expose.area));
event->expose.count = 0;
append_event (event);
@ -1499,7 +1499,7 @@ _gdk_win32_hrgn_to_region (HRGN hrgn)
return NULL;
}
result = gdk_region_new ();
result = cairo_region_create ();
rects = (RECT *) rgndata->Buffer;
for (i = 0; i < rgndata->rdh.nCount; i++)
{
@ -1510,7 +1510,7 @@ _gdk_win32_hrgn_to_region (HRGN hrgn)
r.width = rects[i].right - r.x;
r.height = rects[i].bottom - r.y;
gdk_region_union_with_rect (result, &r);
cairo_region_union_rectangle (result, &r);
}
g_free (rgndata);
@ -1598,9 +1598,9 @@ handle_wm_paint (MSG *msg,
}
update_region = _gdk_win32_hrgn_to_region (hrgn);
if (!gdk_region_empty (update_region))
if (!cairo_region_is_empty (update_region))
_gdk_window_invalidate_for_expose (window, update_region);
gdk_region_destroy (update_region);
cairo_region_destroy (update_region);
DeleteObject (hrgn);
}

View File

@ -252,26 +252,26 @@ gdk_window_clip_changed (GdkWindow *window,
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
old_clip_region = gdk_region_rectangle (old_clip);
new_clip_region = gdk_region_rectangle (new_clip);
old_clip_region = cairo_region_create_rectangle (old_clip);
new_clip_region = cairo_region_create_rectangle (new_clip);
/* Trim invalid region of window to new clip rectangle
*/
if (obj->update_area)
gdk_region_intersect (obj->update_area, new_clip_region);
cairo_region_intersect (obj->update_area, new_clip_region);
/* Invalidate newly exposed portion of window
*/
gdk_region_subtract (new_clip_region, old_clip_region);
if (!gdk_region_empty (new_clip_region))
cairo_region_subtract (new_clip_region, old_clip_region);
if (!cairo_region_is_empty (new_clip_region))
gdk_window_tmp_unset_bg (window);
else
{
gdk_region_destroy (new_clip_region);
cairo_region_destroy (new_clip_region);
new_clip_region = NULL;
}
gdk_region_destroy (old_clip_region);
cairo_region_destroy (old_clip_region);
return new_clip_region;
}
@ -288,7 +288,7 @@ gdk_window_post_scroll (GdkWindow *window,
gdk_window_invalidate_region (window, new_clip_region, FALSE);
g_print ("gdk_window_post_scroll\n");
gdk_region_destroy (new_clip_region);
cairo_region_destroy (new_clip_region);
}
#endif

View File

@ -338,7 +338,7 @@ free_cache_child (GdkCacheChild *child,
GdkDisplay *display)
{
if (child->shape)
gdk_region_destroy (child->shape);
cairo_region_destroy (child->shape);
if (child->shape_selected && display)
{
@ -397,7 +397,7 @@ gdk_window_cache_shape_filter (GdkXEvent *xev,
child->shape_valid = FALSE;
if (child->shape)
{
gdk_region_destroy (child->shape);
cairo_region_destroy (child->shape);
child->shape = NULL;
}
}
@ -639,8 +639,8 @@ is_pointer_within_shape (GdkDisplay *display,
child->xid, ShapeInput);
if (child->shape && input_shape)
{
gdk_region_intersect (child->shape, input_shape);
gdk_region_destroy (input_shape);
cairo_region_intersect (child->shape, input_shape);
cairo_region_destroy (input_shape);
}
else if (input_shape)
{
@ -652,7 +652,7 @@ is_pointer_within_shape (GdkDisplay *display,
}
return child->shape == NULL ||
gdk_region_point_in (child->shape, x_pos, y_pos);
cairo_region_contains_point (child->shape, x_pos, y_pos);
}
static Window

View File

@ -148,11 +148,11 @@ queue_item_free (GdkWindowQueueItem *item)
}
if (item->type == GDK_WINDOW_QUEUE_ANTIEXPOSE)
gdk_region_destroy (item->u.antiexpose.area);
cairo_region_destroy (item->u.antiexpose.area);
else
{
if (item->u.translate.area)
gdk_region_destroy (item->u.translate.area);
cairo_region_destroy (item->u.translate.area);
}
g_free (item);
@ -235,7 +235,7 @@ _gdk_x11_window_queue_translation (GdkWindow *window,
{
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
item->type = GDK_WINDOW_QUEUE_TRANSLATE;
item->u.translate.area = area ? gdk_region_copy (area) : NULL;
item->u.translate.area = area ? cairo_region_copy (area) : NULL;
item->u.translate.dx = dx;
item->u.translate.dy = dy;
@ -265,7 +265,7 @@ _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area)
{
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *invalidate_region = cairo_region_create_rectangle (area);
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
if (display_x11->translate_queue)
@ -288,19 +288,19 @@ _gdk_window_process_expose (GdkWindow *window,
{
GdkRegion *intersection;
intersection = gdk_region_copy (invalidate_region);
gdk_region_intersect (intersection, item->u.translate.area);
gdk_region_subtract (invalidate_region, intersection);
gdk_region_offset (intersection, item->u.translate.dx, item->u.translate.dy);
gdk_region_union (invalidate_region, intersection);
gdk_region_destroy (intersection);
intersection = cairo_region_copy (invalidate_region);
cairo_region_intersect (intersection, item->u.translate.area);
cairo_region_subtract (invalidate_region, intersection);
cairo_region_translate (intersection, item->u.translate.dx, item->u.translate.dy);
cairo_region_union (invalidate_region, intersection);
cairo_region_destroy (intersection);
}
else
gdk_region_offset (invalidate_region, item->u.translate.dx, item->u.translate.dy);
cairo_region_translate (invalidate_region, item->u.translate.dx, item->u.translate.dy);
}
else /* anti-expose */
{
gdk_region_subtract (invalidate_region, item->u.antiexpose.area);
cairo_region_subtract (invalidate_region, item->u.antiexpose.area);
}
}
}
@ -313,10 +313,10 @@ _gdk_window_process_expose (GdkWindow *window,
}
}
if (!gdk_region_empty (invalidate_region))
if (!cairo_region_is_empty (invalidate_region))
_gdk_window_invalidate_for_expose (window, invalidate_region);
gdk_region_destroy (invalidate_region);
cairo_region_destroy (invalidate_region);
}
#define __GDK_GEOMETRY_X11_C__

View File

@ -1687,20 +1687,19 @@ gdk_window_x11_clear_region (GdkWindow *window,
GdkRegion *region,
gboolean send_expose)
{
GdkRectangle *rectangles;
int n_rectangles, i;
cairo_rectangle_int_t rect;
int n_rects, i;
gdk_region_get_rectangles (region,
&rectangles,
&n_rectangles);
n_rects = cairo_region_num_rectangles (region);
for (i = 0; i < n_rectangles; i++)
XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
rectangles[i].x, rectangles[i].y,
rectangles[i].width, rectangles[i].height,
send_expose);
g_free (rectangles);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (region, i, &rect);
XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
rect.x, rect.y,
rect.width, rect.height,
send_expose);
}
}
static void
@ -4574,7 +4573,7 @@ _xwindow_get_shape (Display *xdisplay,
shape_type, &rn, &ord);
if (xrl == NULL || rn == 0)
return gdk_region_new (); /* Empty */
return cairo_region_create (); /* Empty */
if (ord != YXBanded)
{

View File

@ -2676,9 +2676,9 @@ gtk_container_propagate_expose (GtkContainer *container,
g_object_ref (child_event->expose.window);
child_event->expose.region = gtk_widget_region_intersect (child, event->region);
if (!gdk_region_empty (child_event->expose.region))
if (!cairo_region_is_empty (child_event->expose.region))
{
gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
cairo_region_get_extents (child_event->expose.region, &child_event->expose.area);
gtk_widget_send_expose (child, child_event);
}
gdk_event_free (child_event);

View File

@ -1588,7 +1588,7 @@ gtk_icon_view_expose (GtkWidget *widget,
area.width = item->width;
area.height = item->height;
if (gdk_region_rect_in (expose->region, &area) == GDK_OVERLAP_RECTANGLE_OUT)
if (cairo_region_contains_rectangle (expose->region, &area) == CAIRO_REGION_OVERLAP_OUT)
continue;
gtk_icon_view_paint_item (icon_view, cr, item, &expose->area,
@ -1660,17 +1660,16 @@ gtk_icon_view_expose (GtkWidget *widget,
if (icon_view->priv->doing_rubberband)
{
GdkRectangle *rectangles;
cairo_rectangle_int_t rectangle;
gint n_rectangles;
gdk_region_get_rectangles (expose->region,
&rectangles,
&n_rectangles);
n_rectangles = cairo_region_num_rectangles (expose->region);
while (n_rectangles--)
gtk_icon_view_paint_rubberband (icon_view, cr, &rectangles[n_rectangles]);
g_free (rectangles);
{
cairo_region_get_rectangle (expose->region, n_rectangles--, &rectangle);
gtk_icon_view_paint_rubberband (icon_view, cr, &rectangle);
}
}
cairo_destroy (cr);
@ -2345,8 +2344,8 @@ gtk_icon_view_update_rubberband (gpointer data)
new_area.width = ABS (x - icon_view->priv->rubberband_x1) + 1;
new_area.height = ABS (y - icon_view->priv->rubberband_y1) + 1;
invalid_region = gdk_region_rectangle (&old_area);
gdk_region_union_with_rect (invalid_region, &new_area);
invalid_region = cairo_region_create_rectangle (&old_area);
cairo_region_union_rectangle (invalid_region, &new_area);
gdk_rectangle_intersect (&old_area, &new_area, &common);
if (common.width > 2 && common.height > 2)
@ -2359,15 +2358,15 @@ gtk_icon_view_update_rubberband (gpointer data)
common.width -= 2;
common.height -= 2;
common_region = gdk_region_rectangle (&common);
common_region = cairo_region_create_rectangle (&common);
gdk_region_subtract (invalid_region, common_region);
gdk_region_destroy (common_region);
cairo_region_subtract (invalid_region, common_region);
cairo_region_destroy (common_region);
}
gdk_window_invalidate_region (icon_view->priv->bin_window, invalid_region, TRUE);
gdk_region_destroy (invalid_region);
cairo_region_destroy (invalid_region);
icon_view->priv->rubberband_x2 = x;
icon_view->priv->rubberband_y2 = y;

View File

@ -4015,7 +4015,7 @@ gtk_label_expose (GtkWidget *widget,
x, y,
range,
1);
gdk_region_intersect (clip, event->region);
cairo_region_intersect (clip, event->region);
/* FIXME should use gtk_paint, but it can't use a clip
* region
@ -4036,7 +4036,7 @@ gtk_label_expose (GtkWidget *widget,
&widget->style->base[state]);
gdk_gc_set_clip_region (widget->style->black_gc, NULL);
gdk_region_destroy (clip);
cairo_region_destroy (clip);
}
else if (info)
{
@ -4086,7 +4086,7 @@ gtk_label_expose (GtkWidget *widget,
gdk_color_free (visited_link_color);
gdk_gc_set_clip_region (widget->style->black_gc, NULL);
gdk_region_destroy (clip);
cairo_region_destroy (clip);
}
if (focus_link && gtk_widget_has_focus (widget))
@ -4098,13 +4098,13 @@ gtk_label_expose (GtkWidget *widget,
x, y,
range,
1);
gdk_region_get_clipbox (clip, &rect);
cairo_region_get_extents (clip, &rect);
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
&event->area, widget, "label",
rect.x, rect.y, rect.width, rect.height);
gdk_region_destroy (clip);
cairo_region_destroy (clip);
}
}
}

View File

@ -426,7 +426,7 @@ get_selected_clip (GtkTextRenderer *text_renderer,
{
gint *ranges;
gint n_ranges, i;
GdkRegion *clip_region = gdk_region_new ();
GdkRegion *clip_region = cairo_region_create ();
GdkRegion *tmp_region;
pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
@ -440,12 +440,12 @@ get_selected_clip (GtkTextRenderer *text_renderer,
rect.width = PANGO_PIXELS (ranges[2*i + 1]) - PANGO_PIXELS (ranges[2*i]);
rect.height = height;
gdk_region_union_with_rect (clip_region, &rect);
cairo_region_union_rectangle (clip_region, &rect);
}
tmp_region = gdk_region_rectangle (&text_renderer->clip_rect);
gdk_region_intersect (clip_region, tmp_region);
gdk_region_destroy (tmp_region);
tmp_region = cairo_region_create_rectangle (&text_renderer->clip_rect);
cairo_region_intersect (clip_region, tmp_region);
cairo_region_destroy (tmp_region);
g_free (ranges);
return clip_region;
@ -612,7 +612,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_gc_set_clip_region (fg_gc, NULL);
gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (text_renderer), fg_gc);
gdk_region_destroy (clip_region);
cairo_region_destroy (clip_region);
/* Paint in the ends of the line */
if (line_rect.x > line_display->left_margin * PANGO_SCALE &&

View File

@ -4044,8 +4044,8 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
new_area.width = ABS (x - tree_view->priv->press_start_x) + 1;
new_area.height = ABS (y - tree_view->priv->press_start_y) + 1;
invalid_region = gdk_region_rectangle (&old_area);
gdk_region_union_with_rect (invalid_region, &new_area);
invalid_region = cairo_region_create_rectangle (&old_area);
cairo_region_union_rectangle (invalid_region, &new_area);
gdk_rectangle_intersect (&old_area, &new_area, &common);
if (common.width > 2 && common.height > 2)
@ -4058,15 +4058,15 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
common.width -= 2;
common.height -= 2;
common_region = gdk_region_rectangle (&common);
common_region = cairo_region_create_rectangle (&common);
gdk_region_subtract (invalid_region, common_region);
gdk_region_destroy (common_region);
cairo_region_subtract (invalid_region, common_region);
cairo_region_destroy (common_region);
}
gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE);
gdk_region_destroy (invalid_region);
cairo_region_destroy (invalid_region);
tree_view->priv->rubber_band_x = x;
tree_view->priv->rubber_band_y = y;
@ -4532,7 +4532,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
cell_area.height -= grid_line_width;
}
if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT)
if (cairo_region_contains_rectangle (event->region, &background_area) == CAIRO_REGION_OVERLAP_OUT)
{
cell_offset += column->width;
continue;
@ -5003,20 +5003,19 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
done:
gtk_tree_view_draw_grid_lines (tree_view, event, n_visible_columns);
if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
{
GdkRectangle *rectangles;
gint n_rectangles;
gdk_region_get_rectangles (event->region,
&rectangles,
&n_rectangles);
while (n_rectangles--)
gtk_tree_view_paint_rubber_band (tree_view, &rectangles[n_rectangles]);
g_free (rectangles);
}
if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
{
GdkRectangle rectangle;
gint n_rectangles;
n_rectangles = cairo_region_num_rectangles (event->region);
while (n_rectangles--)
{
cairo_region_get_rectangle (event->region, n_rectangles, &rectangle);
gtk_tree_view_paint_rubber_band (tree_view, &rectangle);
}
}
if (cursor_path)
gtk_tree_path_free (cursor_path);

View File

@ -3913,7 +3913,7 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
int x, y;
gdk_window_get_position (widget->window, &x, &y);
gdk_region_offset (region, -x, -y);
cairo_region_translate (region, -x, -y);
}
gdk_window_invalidate_maybe_recurse (widget->window, region,
@ -3952,9 +3952,9 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
rect.y += wy;
}
region = gdk_region_rectangle (&rect);
region = cairo_region_create_rectangle (&rect);
gtk_widget_invalidate_widget_windows (widget, region);
gdk_region_destroy (region);
cairo_region_destroy (region);
}
/**
@ -4042,11 +4042,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
{
/* Invalidate union(old_allaction,widget->allocation) in widget->window
*/
GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
gdk_region_union_with_rect (invalidate, &old_allocation);
GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
cairo_region_union_rectangle (invalidate, &old_allocation);
gdk_window_invalidate_region (widget->window, invalidate, FALSE);
gdk_region_destroy (invalidate);
cairo_region_destroy (invalidate);
}
if (size_changed)
@ -4055,11 +4055,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
{
/* Invalidate union(old_allaction,widget->allocation) in widget->window and descendents owned by widget
*/
GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
gdk_region_union_with_rect (invalidate, &old_allocation);
GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
cairo_region_union_rectangle (invalidate, &old_allocation);
gtk_widget_invalidate_widget_windows (widget, invalidate);
gdk_region_destroy (invalidate);
cairo_region_destroy (invalidate);
}
}
}
@ -4067,9 +4067,9 @@ gtk_widget_size_allocate (GtkWidget *widget,
if ((size_changed || position_changed) && widget->parent &&
gtk_widget_get_realized (widget->parent) && GTK_CONTAINER (widget->parent)->reallocate_redraws)
{
GdkRegion *invalidate = gdk_region_rectangle (&widget->parent->allocation);
GdkRegion *invalidate = cairo_region_create_rectangle (&widget->parent->allocation);
gtk_widget_invalidate_widget_windows (widget->parent, invalidate);
gdk_region_destroy (invalidate);
cairo_region_destroy (invalidate);
}
}
@ -5188,7 +5188,7 @@ gtk_widget_intersect (GtkWidget *widget,
* widgets with their own window.
*
* Computes the intersection of a @widget's area and @region, returning
* the intersection. The result may be empty, use gdk_region_empty() to
* the intersection. The result may be empty, use cairo_region_is_empty() to
* check.
**/
GdkRegion *
@ -5203,9 +5203,9 @@ gtk_widget_region_intersect (GtkWidget *widget,
gtk_widget_get_draw_rectangle (widget, &rect);
dest = gdk_region_rectangle (&rect);
dest = cairo_region_create_rectangle (&rect);
gdk_region_intersect (dest, region);
cairo_region_intersect (dest, region);
return dest;
}
@ -9659,7 +9659,7 @@ expose_window (GdkWindow *window)
gdk_drawable_get_size (GDK_DRAWABLE (window),
&event.expose.area.width,
&event.expose.area.height);
event.expose.region = gdk_region_rectangle (&event.expose.area);
event.expose.region = cairo_region_create_rectangle (&event.expose.area);
/* If this is not double buffered, force a double buffer so that
redirection works. */

View File

@ -457,8 +457,8 @@ window_expose_event (GtkWidget *widget,
child->allocation.y);
/* draw no more than our expose event intersects our child */
region = gdk_region_rectangle (&child->allocation);
gdk_region_intersect (region, event->region);
region = cairo_region_create_rectangle (&child->allocation);
cairo_region_intersect (region, event->region);
gdk_cairo_region (cr, region);
cairo_clip (cr);
@ -7747,7 +7747,7 @@ create_shapes (GtkWidget *widget)
/* reset shape from mask to a region */
x = 0;
y = 0;
region = gdk_region_new ();
region = cairo_region_create ();
while (x < 460)
{
@ -7759,7 +7759,7 @@ create_shapes (GtkWidget *widget)
rect.width = 10;
rect.height = 10;
gdk_region_union_with_rect (region, &rect);
cairo_region_union_rectangle (region, &rect);
y += 20;
}