forked from AuroraMiddleware/gtk
surface: Simplify gdk_surface_invalidate_region()
Remove duplicate functions and unused arguments. Functionality is identical otherwise.
This commit is contained in:
parent
8202f333ea
commit
2a4ffd4a59
@ -342,9 +342,6 @@ void _gdk_windowing_got_event (GdkDisplay *display,
|
||||
|
||||
#define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_SURFACE_STATE_WITHDRAWN) == 0)
|
||||
|
||||
void _gdk_surface_invalidate_for_expose (GdkSurface *surface,
|
||||
cairo_region_t *region);
|
||||
|
||||
GdkSurface * _gdk_surface_find_child_at (GdkSurface *surface,
|
||||
double x, double y);
|
||||
GdkSurface * _gdk_surface_find_descendant_at (GdkSurface *toplevel,
|
||||
|
135
gdk/gdksurface.c
135
gdk/gdksurface.c
@ -131,12 +131,6 @@ static void update_cursor (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
static void impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||
cairo_region_t *region);
|
||||
static void gdk_surface_invalidate_region_full (GdkSurface *surface,
|
||||
const cairo_region_t *region,
|
||||
gboolean invalidate_children);
|
||||
static void gdk_surface_invalidate_rect_full (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
gboolean invalidate_children);
|
||||
static cairo_surface_t *gdk_surface_ref_impl_surface (GdkSurface *surface);
|
||||
|
||||
static void gdk_surface_set_frame_clock (GdkSurface *surface,
|
||||
@ -2173,10 +2167,20 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
|
||||
g_object_unref (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_invalidate_rect_full (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
gboolean invalidate_children)
|
||||
/**
|
||||
* gdk_surface_invalidate_rect:
|
||||
* @surface: a #GdkSurface
|
||||
* @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
|
||||
* surface
|
||||
* @invalidate_children: whether to also invalidate child surfaces
|
||||
*
|
||||
* A convenience wrapper around gdk_surface_invalidate_region() which
|
||||
* invalidates a rectangular region. See
|
||||
* gdk_surface_invalidate_region() for details.
|
||||
**/
|
||||
void
|
||||
gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect)
|
||||
{
|
||||
GdkRectangle surface_rect;
|
||||
cairo_region_t *region;
|
||||
@ -2199,29 +2203,10 @@ gdk_surface_invalidate_rect_full (GdkSurface *surface,
|
||||
}
|
||||
|
||||
region = cairo_region_create_rectangle (rect);
|
||||
gdk_surface_invalidate_region_full (surface, region, invalidate_children);
|
||||
gdk_surface_invalidate_region (surface, region);
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_invalidate_rect:
|
||||
* @surface: a #GdkSurface
|
||||
* @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
|
||||
* surface
|
||||
* @invalidate_children: whether to also invalidate child surfaces
|
||||
*
|
||||
* A convenience wrapper around gdk_surface_invalidate_region() which
|
||||
* invalidates a rectangular region. See
|
||||
* gdk_surface_invalidate_region() for details.
|
||||
**/
|
||||
void
|
||||
gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
gboolean invalidate_children)
|
||||
{
|
||||
gdk_surface_invalidate_rect_full (surface, rect, invalidate_children);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||
cairo_region_t *region)
|
||||
@ -2236,9 +2221,27 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_invalidate_full (GdkSurface *surface,
|
||||
const cairo_region_t *region)
|
||||
/**
|
||||
* gdk_surface_invalidate_region:
|
||||
* @surface: a #GdkSurface
|
||||
* @region: a #cairo_region_t
|
||||
* @invalidate_children: %TRUE to also invalidate child surfaces
|
||||
*
|
||||
* Adds @region to the update area for @surface. The update area is the
|
||||
* region that needs to be redrawn, or “dirty region.”
|
||||
*
|
||||
* GDK will process all updates whenever the frame clock schedules a redraw,
|
||||
* so there’s no need to do forces redraws manually, you just need to
|
||||
* invalidate regions that you know should be redrawn.
|
||||
*
|
||||
* The @invalidate_children parameter controls whether the region of
|
||||
* each child surface that intersects @region will also be invalidated.
|
||||
* If %FALSE, then the update area for child surfaces will remain
|
||||
* unaffected.
|
||||
**/
|
||||
void
|
||||
gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region)
|
||||
{
|
||||
cairo_region_t *visible_region;
|
||||
cairo_rectangle_int_t r;
|
||||
@ -2281,62 +2284,6 @@ gdk_surface_invalidate_full (GdkSurface *surface,
|
||||
cairo_region_destroy (visible_region);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_invalidate_region_full (GdkSurface *surface,
|
||||
const cairo_region_t *region,
|
||||
gboolean invalidate_children)
|
||||
{
|
||||
gdk_surface_invalidate_full (surface, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_invalidate_region:
|
||||
* @surface: a #GdkSurface
|
||||
* @region: a #cairo_region_t
|
||||
* @invalidate_children: %TRUE to also invalidate child surfaces
|
||||
*
|
||||
* Adds @region to the update area for @surface. The update area is the
|
||||
* region that needs to be redrawn, or “dirty region.”
|
||||
*
|
||||
* GDK will process all updates whenever the frame clock schedules a redraw,
|
||||
* so there’s no need to do forces redraws manually, you just need to
|
||||
* invalidate regions that you know should be redrawn.
|
||||
*
|
||||
* The @invalidate_children parameter controls whether the region of
|
||||
* each child surface that intersects @region will also be invalidated.
|
||||
* If %FALSE, then the update area for child surfaces will remain
|
||||
* unaffected.
|
||||
**/
|
||||
void
|
||||
gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region,
|
||||
gboolean invalidate_children)
|
||||
{
|
||||
gdk_surface_invalidate_full (surface, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_surface_invalidate_for_expose:
|
||||
* @surface: a #GdkSurface
|
||||
* @region: a #cairo_region_t
|
||||
*
|
||||
* Adds @region to the update area for @surface.
|
||||
*
|
||||
* GDK will process all updates whenever the frame clock schedules a redraw,
|
||||
* so there’s no need to do forces redraws manually, you just need to
|
||||
* invalidate regions that you know should be redrawn.
|
||||
*
|
||||
* This version of invalidation is used when you recieve expose events
|
||||
* from the native surface system. It exposes the native surface, plus
|
||||
* any non-native child surfaces.
|
||||
**/
|
||||
void
|
||||
_gdk_surface_invalidate_for_expose (GdkSurface *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
gdk_surface_invalidate_full (surface, region);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_surface_clear_update_area:
|
||||
* @surface: a #GdkSurface.
|
||||
@ -2770,7 +2717,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
||||
recompute_visible_regions (surface, FALSE);
|
||||
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2821,7 +2768,7 @@ gdk_surface_raise (GdkSurface *surface)
|
||||
!gdk_surface_is_toplevel (surface) &&
|
||||
gdk_surface_is_viewable (surface) &&
|
||||
!surface->input_only)
|
||||
gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2862,7 +2809,7 @@ gdk_surface_invalidate_in_parent (GdkSurface *private)
|
||||
child.height = private->height;
|
||||
gdk_rectangle_intersect (&r, &child, &r);
|
||||
|
||||
gdk_surface_invalidate_rect_full (private->parent, &r, TRUE);
|
||||
gdk_surface_invalidate_rect (private->parent, &r);
|
||||
}
|
||||
|
||||
|
||||
@ -3365,7 +3312,7 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
|
||||
|
||||
cairo_region_union (new_region, old_region);
|
||||
|
||||
gdk_surface_invalidate_region_full (surface->parent, new_region, TRUE);
|
||||
gdk_surface_invalidate_region (surface->parent, new_region);
|
||||
|
||||
cairo_region_destroy (old_region);
|
||||
cairo_region_destroy (new_region);
|
||||
@ -5841,7 +5788,7 @@ gdk_surface_set_opacity (GdkSurface *surface,
|
||||
else
|
||||
{
|
||||
recompute_visible_regions (surface, FALSE);
|
||||
gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -804,12 +804,10 @@ void gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
|
||||
/* Interface for dirty-region queueing */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
gboolean invalidate_children);
|
||||
const GdkRectangle *rect);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region,
|
||||
gboolean invalidate_children);
|
||||
const cairo_region_t *region);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_freeze_updates (GdkSurface *surface);
|
||||
|
@ -384,7 +384,7 @@ gdk_wayland_drag_context_set_hotspot (GdkDragContext *context,
|
||||
|
||||
_gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
|
||||
-hot_x, -hot_y);
|
||||
gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect, FALSE);
|
||||
gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -314,8 +314,6 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
||||
int scale)
|
||||
{
|
||||
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
|
||||
GdkRectangle area;
|
||||
cairo_region_t *region;
|
||||
|
||||
if ((surface->width == width) &&
|
||||
(surface->height == height) &&
|
||||
@ -333,14 +331,7 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
||||
if (impl->display_server.wl_surface)
|
||||
wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
area.width = surface->width;
|
||||
area.height = surface->height;
|
||||
|
||||
region = cairo_region_create_rectangle (&area);
|
||||
_gdk_surface_invalidate_for_expose (surface, region);
|
||||
cairo_region_destroy (region);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
|
@ -748,7 +748,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
y2 = (xevent->xexpose.y + xevent->xexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
|
||||
expose_rect.height = y2 - expose_rect.y;
|
||||
|
||||
_gdk_x11_surface_process_expose (surface, xevent->xexpose.serial, &expose_rect);
|
||||
gdk_surface_invalidate_rect (surface, &expose_rect);
|
||||
return_val = FALSE;
|
||||
}
|
||||
|
||||
@ -778,7 +778,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
|
||||
expose_rect.height = y2 - expose_rect.y;
|
||||
|
||||
_gdk_x11_surface_process_expose (surface, xevent->xgraphicsexpose.serial, &expose_rect);
|
||||
gdk_surface_invalidate_rect (surface, &expose_rect);
|
||||
return_val = FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdksurface-x11.h"
|
||||
|
||||
|
||||
void
|
||||
_gdk_x11_surface_process_expose (GdkSurface *surface,
|
||||
gulong serial,
|
||||
GdkRectangle *area)
|
||||
{
|
||||
cairo_region_t *invalidate_region = cairo_region_create_rectangle (area);
|
||||
|
||||
if (!cairo_region_is_empty (invalidate_region))
|
||||
_gdk_surface_invalidate_for_expose (surface, invalidate_region);
|
||||
|
||||
cairo_region_destroy (invalidate_region);
|
||||
}
|
@ -78,11 +78,6 @@ gint _gdk_x11_display_send_xevent (GdkDisplay *display,
|
||||
glong event_mask,
|
||||
XEvent *event_send);
|
||||
|
||||
/* Routines from gdkgeometry-x11.c */
|
||||
void _gdk_x11_surface_process_expose (GdkSurface *window,
|
||||
gulong serial,
|
||||
GdkRectangle *area);
|
||||
|
||||
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
|
||||
Window window,
|
||||
gint scale,
|
||||
|
@ -1638,7 +1638,7 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
|
||||
surface->height * impl->surface_scale);
|
||||
}
|
||||
|
||||
gdk_surface_invalidate_rect (surface, NULL, TRUE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -13,7 +13,6 @@ gdk_x11_sources = files([
|
||||
'gdkdnd-x11.c',
|
||||
'gdkeventsource.c',
|
||||
'gdkeventtranslator.c',
|
||||
'gdkgeometry-x11.c',
|
||||
'gdkglcontext-x11.c',
|
||||
'gdkkeys-x11.c',
|
||||
'gdkmain-x11.c',
|
||||
|
@ -180,7 +180,7 @@ gtk_window_manage_updates (GtkWidget *widget,
|
||||
cairo_region_union (region, draw->region);
|
||||
}
|
||||
gtk_debug_updates_print (updates, region, "Queued update");
|
||||
gdk_surface_invalidate_region (gtk_widget_get_surface (widget), region, TRUE);
|
||||
gdk_surface_invalidate_region (gtk_widget_get_surface (widget), region);
|
||||
cairo_region_destroy (region);
|
||||
|
||||
/* Then remove all outdated regions */
|
||||
|
@ -4338,7 +4338,7 @@ gtk_widget_queue_draw_region (GtkWidget *widget,
|
||||
|
||||
invalidate:
|
||||
gtk_debug_updates_add (windowed_parent, region2);
|
||||
gdk_surface_invalidate_region (_gtk_widget_get_surface (widget), region2, TRUE);
|
||||
gdk_surface_invalidate_region (_gtk_widget_get_surface (widget), region2);
|
||||
|
||||
cairo_region_destroy (region2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user