mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
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)
|
#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,
|
GdkSurface * _gdk_surface_find_child_at (GdkSurface *surface,
|
||||||
double x, double y);
|
double x, double y);
|
||||||
GdkSurface * _gdk_surface_find_descendant_at (GdkSurface *toplevel,
|
GdkSurface * _gdk_surface_find_descendant_at (GdkSurface *toplevel,
|
||||||
|
133
gdk/gdksurface.c
133
gdk/gdksurface.c
@ -131,12 +131,6 @@ static void update_cursor (GdkDisplay *display,
|
|||||||
GdkDevice *device);
|
GdkDevice *device);
|
||||||
static void impl_surface_add_update_area (GdkSurface *impl_surface,
|
static void impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||||
cairo_region_t *region);
|
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 cairo_surface_t *gdk_surface_ref_impl_surface (GdkSurface *surface);
|
||||||
|
|
||||||
static void gdk_surface_set_frame_clock (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);
|
g_object_unref (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/**
|
||||||
gdk_surface_invalidate_rect_full (GdkSurface *surface,
|
* gdk_surface_invalidate_rect:
|
||||||
const GdkRectangle *rect,
|
* @surface: a #GdkSurface
|
||||||
gboolean invalidate_children)
|
* @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;
|
GdkRectangle surface_rect;
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
@ -2199,29 +2203,10 @@ gdk_surface_invalidate_rect_full (GdkSurface *surface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
region = cairo_region_create_rectangle (rect);
|
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);
|
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
|
static void
|
||||||
impl_surface_add_update_area (GdkSurface *impl_surface,
|
impl_surface_add_update_area (GdkSurface *impl_surface,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
@ -2236,8 +2221,26 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/**
|
||||||
gdk_surface_invalidate_full (GdkSurface *surface,
|
* 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)
|
const cairo_region_t *region)
|
||||||
{
|
{
|
||||||
cairo_region_t *visible_region;
|
cairo_region_t *visible_region;
|
||||||
@ -2281,62 +2284,6 @@ gdk_surface_invalidate_full (GdkSurface *surface,
|
|||||||
cairo_region_destroy (visible_region);
|
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:
|
* _gdk_surface_clear_update_area:
|
||||||
* @surface: a #GdkSurface.
|
* @surface: a #GdkSurface.
|
||||||
@ -2770,7 +2717,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
|||||||
recompute_visible_regions (surface, FALSE);
|
recompute_visible_regions (surface, FALSE);
|
||||||
|
|
||||||
if (gdk_surface_is_viewable (surface))
|
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_toplevel (surface) &&
|
||||||
gdk_surface_is_viewable (surface) &&
|
gdk_surface_is_viewable (surface) &&
|
||||||
!surface->input_only)
|
!surface->input_only)
|
||||||
gdk_surface_invalidate_rect_full (surface, NULL, TRUE);
|
gdk_surface_invalidate_rect (surface, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2862,7 +2809,7 @@ gdk_surface_invalidate_in_parent (GdkSurface *private)
|
|||||||
child.height = private->height;
|
child.height = private->height;
|
||||||
gdk_rectangle_intersect (&r, &child, &r);
|
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);
|
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 (old_region);
|
||||||
cairo_region_destroy (new_region);
|
cairo_region_destroy (new_region);
|
||||||
@ -5841,7 +5788,7 @@ gdk_surface_set_opacity (GdkSurface *surface,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
recompute_visible_regions (surface, FALSE);
|
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 */
|
/* Interface for dirty-region queueing */
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gdk_surface_invalidate_rect (GdkSurface *surface,
|
void gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||||
const GdkRectangle *rect,
|
const GdkRectangle *rect);
|
||||||
gboolean invalidate_children);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gdk_surface_invalidate_region (GdkSurface *surface,
|
void gdk_surface_invalidate_region (GdkSurface *surface,
|
||||||
const cairo_region_t *region,
|
const cairo_region_t *region);
|
||||||
gboolean invalidate_children);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gdk_surface_freeze_updates (GdkSurface *surface);
|
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,
|
_gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
|
||||||
-hot_x, -hot_y);
|
-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
|
static void
|
||||||
|
@ -314,8 +314,6 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
|||||||
int scale)
|
int scale)
|
||||||
{
|
{
|
||||||
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
|
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
|
||||||
GdkRectangle area;
|
|
||||||
cairo_region_t *region;
|
|
||||||
|
|
||||||
if ((surface->width == width) &&
|
if ((surface->width == width) &&
|
||||||
(surface->height == height) &&
|
(surface->height == height) &&
|
||||||
@ -333,14 +331,7 @@ gdk_wayland_surface_update_size (GdkSurface *surface,
|
|||||||
if (impl->display_server.wl_surface)
|
if (impl->display_server.wl_surface)
|
||||||
wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
|
wl_surface_set_buffer_scale (impl->display_server.wl_surface, scale);
|
||||||
|
|
||||||
area.x = 0;
|
gdk_surface_invalidate_rect (surface, NULL);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
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;
|
y2 = (xevent->xexpose.y + xevent->xexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
|
||||||
expose_rect.height = y2 - expose_rect.y;
|
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;
|
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;
|
y2 = (xevent->xgraphicsexpose.y + xevent->xgraphicsexpose.height + surface_impl->surface_scale -1) / surface_impl->surface_scale;
|
||||||
expose_rect.height = y2 - expose_rect.y;
|
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;
|
return_val = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
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,
|
glong event_mask,
|
||||||
XEvent *event_send);
|
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,
|
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
|
||||||
Window window,
|
Window window,
|
||||||
gint scale,
|
gint scale,
|
||||||
|
@ -1638,7 +1638,7 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface,
|
|||||||
surface->height * impl->surface_scale);
|
surface->height * impl->surface_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_surface_invalidate_rect (surface, NULL, TRUE);
|
gdk_surface_invalidate_rect (surface, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -13,7 +13,6 @@ gdk_x11_sources = files([
|
|||||||
'gdkdnd-x11.c',
|
'gdkdnd-x11.c',
|
||||||
'gdkeventsource.c',
|
'gdkeventsource.c',
|
||||||
'gdkeventtranslator.c',
|
'gdkeventtranslator.c',
|
||||||
'gdkgeometry-x11.c',
|
|
||||||
'gdkglcontext-x11.c',
|
'gdkglcontext-x11.c',
|
||||||
'gdkkeys-x11.c',
|
'gdkkeys-x11.c',
|
||||||
'gdkmain-x11.c',
|
'gdkmain-x11.c',
|
||||||
|
@ -180,7 +180,7 @@ gtk_window_manage_updates (GtkWidget *widget,
|
|||||||
cairo_region_union (region, draw->region);
|
cairo_region_union (region, draw->region);
|
||||||
}
|
}
|
||||||
gtk_debug_updates_print (updates, region, "Queued update");
|
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);
|
cairo_region_destroy (region);
|
||||||
|
|
||||||
/* Then remove all outdated regions */
|
/* Then remove all outdated regions */
|
||||||
|
@ -4338,7 +4338,7 @@ gtk_widget_queue_draw_region (GtkWidget *widget,
|
|||||||
|
|
||||||
invalidate:
|
invalidate:
|
||||||
gtk_debug_updates_add (windowed_parent, region2);
|
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);
|
cairo_region_destroy (region2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user