[gtk+/wip/simple-draw4: 3/20] gdkwindow: Remove translate vfunc
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/simple-draw4: 3/20] gdkwindow: Remove translate vfunc
- Date: Thu, 2 May 2013 17:16:14 +0000 (UTC)
commit 3431a5346dc73e5ffa5c877c1b35c431ad1bbbed
Author: Alexander Larsson <alexl redhat com>
Date: Wed Apr 17 14:15:51 2013 +0200
gdkwindow: Remove translate vfunc
This is not used anymore
gdk/broadway/gdkwindow-broadway.c | 51 --------------
gdk/gdkoffscreenwindow.c | 37 ----------
gdk/gdkwindowimpl.h | 10 ---
gdk/quartz/gdkwindow-quartz.c | 44 ------------
gdk/wayland/gdkwindow-wayland.c | 10 ---
gdk/win32/gdkwindow-win32.c | 72 --------------------
gdk/x11/gdkgeometry-x11.c | 132 ++-----------------------------------
gdk/x11/gdkwindow-x11.c | 1 -
8 files changed, 6 insertions(+), 351 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 56909bd..4c56968 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -1470,56 +1470,6 @@ _gdk_broadway_window_queue_antiexpose (GdkWindow *window,
return TRUE;
}
-static void
-copy_region (cairo_surface_t *surface,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- cairo_t *cr;
-
- cr = cairo_create (surface);
-
- gdk_cairo_region (cr, area);
- cairo_clip (cr);
-
- /* NB: This is a self-copy and Cairo doesn't support that yet.
- * So we do a litle trick.
- */
- cairo_push_group (cr);
-
- cairo_set_source_surface (cr, surface, dx, dy);
- cairo_paint (cr);
-
- cairo_pop_group_to_source (cr);
- cairo_paint (cr);
-
- cairo_destroy (cr);
-}
-
-void
-_gdk_broadway_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- GdkWindowImplBroadway *impl;
- GdkBroadwayDisplay *broadway_display;
-
- impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
-
- if (impl->surface)
- {
- copy_region (impl->surface, area, dx, dy);
- broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
-
- if (_gdk_broadway_server_window_translate (broadway_display->server,
- impl->id,
- area, dx, dy))
- queue_flush (window);
- }
-}
-
guint32
gdk_broadway_get_last_seen_time (GdkWindow *window)
{
@@ -1558,7 +1508,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
impl_class->input_shape_combine_region = gdk_window_broadway_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_broadway_set_static_gravities;
impl_class->queue_antiexpose = _gdk_broadway_window_queue_antiexpose;
- impl_class->translate = _gdk_broadway_window_translate;
impl_class->destroy = _gdk_broadway_window_destroy;
impl_class->destroy_foreign = gdk_broadway_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_broadway_resize_cairo_surface;
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index c765209..c2703b6 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -555,42 +555,6 @@ gdk_offscreen_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
-static void
-gdk_offscreen_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
-
- if (offscreen->surface)
- {
- cairo_t *cr;
-
- cr = cairo_create (offscreen->surface);
-
- area = cairo_region_copy (area);
-
- gdk_cairo_region (cr, area);
- cairo_clip (cr);
-
- /* NB: This is a self-copy and Cairo doesn't support that yet.
- * So we do a litle trick.
- */
- cairo_push_group (cr);
-
- cairo_set_source_surface (cr, offscreen->surface, dx, dy);
- cairo_paint (cr);
-
- cairo_pop_group_to_source (cr);
- cairo_paint (cr);
-
- cairo_destroy (cr);
- }
-
- _gdk_window_add_damage (window, area);
-}
-
static cairo_surface_t *
gdk_offscreen_window_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
@@ -752,7 +716,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
- impl_class->translate = gdk_offscreen_window_translate;
impl_class->destroy = gdk_offscreen_window_destroy;
impl_class->destroy_foreign = NULL;
impl_class->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index 65149e8..62e21ee 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -125,16 +125,6 @@ struct _GdkWindowImplClass
gboolean (* queue_antiexpose) (GdkWindow *window,
cairo_region_t *update_area);
- /* Called to move @area inside @window by @dx x @dy pixels. @area is
- * guaranteed to be inside @window. If part of @area is not invisible or
- * invalid, it is this function's job to queue expose events in those
- * areas.
- */
- void (* translate) (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy);
-
/* Called to do the windowing system specific part of gdk_window_destroy(),
*
* window: The window being destroyed
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 5550fa8..0b837bb 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2238,49 +2238,6 @@ gdk_quartz_window_queue_antiexpose (GdkWindow *window,
}
static void
-gdk_quartz_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- cairo_region_t *invalidate, *scrolled;
- GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)window->impl;
- GdkRectangle extents;
-
- cairo_region_get_extents (area, &extents);
-
- [impl->view scrollRect:NSMakeRect (extents.x - dx, extents.y - dy,
- extents.width, extents.height)
- by:NSMakeSize (dx, dy)];
-
- if (impl->needs_display_region)
- {
- cairo_region_t *intersection;
-
- /* Invalidate already invalidated area that was moved at new
- * location.
- */
- intersection = cairo_region_copy (impl->needs_display_region);
- cairo_region_intersect (intersection, area);
- cairo_region_translate (intersection, dx, dy);
-
- gdk_quartz_window_set_needs_display_in_region (window, intersection);
- cairo_region_destroy (intersection);
- }
-
- /* Calculate newly exposed area that needs invalidation */
- scrolled = cairo_region_copy (area);
- cairo_region_translate (scrolled, dx, dy);
-
- invalidate = cairo_region_copy (area);
- cairo_region_subtract (invalidate, scrolled);
- cairo_region_destroy (scrolled);
-
- gdk_quartz_window_set_needs_display_in_region (window, invalidate);
- cairo_region_destroy (invalidate);
-}
-
-static void
gdk_quartz_window_set_focus_on_map (GdkWindow *window,
gboolean focus_on_map)
{
@@ -3078,7 +3035,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_quartz_set_static_gravities;
impl_class->queue_antiexpose = gdk_quartz_window_queue_antiexpose;
- impl_class->translate = gdk_quartz_window_translate;
impl_class->destroy = gdk_quartz_window_destroy;
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 2cb05de..a55f355 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1194,15 +1194,6 @@ gdk_wayland_window_queue_antiexpose (GdkWindow *window,
}
static void
-gdk_wayland_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- _gdk_window_invalidate_for_expose (window, area);
-}
-
-static void
gdk_wayland_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
@@ -1908,7 +1899,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->input_shape_combine_region = gdk_window_wayland_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_wayland_set_static_gravities;
impl_class->queue_antiexpose = gdk_wayland_window_queue_antiexpose;
- impl_class->translate = gdk_wayland_window_translate;
impl_class->destroy = gdk_wayland_window_destroy;
impl_class->destroy_foreign = gdk_window_wayland_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_wayland_resize_cairo_surface;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 2c2e15d..4ec80c1 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -3319,77 +3319,6 @@ _gdk_win32_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
-/* Gets called from gdwindow.c(do_move_region_bits_on_impl)
- * and got tested with testgtk::big_window. Given the previous,
- * untested implementation this one looks much too simple ;)
- */
-static void
-_gdk_win32_window_translate (GdkWindow *window,
- cairo_region_t *area, /* In impl window coords */
- gint dx,
- gint dy)
-{
- GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
- HRGN hrgn, area_hrgn;
- cairo_region_t *update_region;
- HDC hdc;
- int ret;
-
- /* Note: This is the destination area, not the source, and
- it has been moved by dx, dy from the source area */
- area_hrgn = cairo_region_to_hrgn (area, 0, 0);
-
- /* First we copy any outstanding invalid areas in the
- source area to the new position in the destination area */
- hrgn = CreateRectRgn (0, 0, 0, 0);
- ret = GetUpdateRgn (GDK_WINDOW_HWND (window), hrgn, FALSE);
- if (ret == ERROR)
- WIN32_API_FAILED ("GetUpdateRgn");
- else if (ret != NULLREGION)
- {
- /* Convert the source invalid region as it would be copied */
- OffsetRgn (hrgn, dx, dy);
- /* Keep what intersects the copy destination area */
- ret = CombineRgn (hrgn, hrgn, area_hrgn, RGN_AND);
- /* And invalidate it */
- if (ret == ERROR)
- WIN32_API_FAILED ("CombineRgn");
- else if (ret != NULLREGION)
- API_CALL (InvalidateRgn, (GDK_WINDOW_HWND (window), hrgn, TRUE));
- }
-
- /* Then we copy the bits, invalidating whatever is copied from
- otherwise invisible areas */
-
- hdc = _gdk_win32_impl_acquire_dc (impl);
-
- /* Clip hdc to target region */
- API_CALL (SelectClipRgn, (hdc, area_hrgn));
-
- SetRectRgn (hrgn, 0, 0, 0, 0);
-
- if (!ScrollDC (hdc, dx, dy, NULL, NULL, hrgn, NULL))
- WIN32_GDI_FAILED ("ScrollDC");
- else
- {
- update_region = _gdk_win32_hrgn_to_region (hrgn);
- if (!cairo_region_is_empty (update_region))
- _gdk_window_invalidate_for_expose (window, update_region);
- cairo_region_destroy (update_region);
- }
-
- /* Unset hdc clip region */
- API_CALL (SelectClipRgn, (hdc, NULL));
-
- _gdk_win32_impl_release_dc (impl);
-
- if (!DeleteObject (hrgn))
- WIN32_GDI_FAILED ("DeleteObject");
-
- if (!DeleteObject (area_hrgn))
- WIN32_GDI_FAILED ("DeleteObject");
-}
-
static void
gdk_win32_input_shape_combine_region (GdkWindow *window,
const cairo_region_t *shape_region,
@@ -3556,7 +3485,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
impl_class->set_static_gravities = gdk_win32_window_set_static_gravities;
impl_class->queue_antiexpose = _gdk_win32_window_queue_antiexpose;
- impl_class->translate = _gdk_win32_window_translate;
impl_class->destroy = gdk_win32_window_destroy;
impl_class->destroy_foreign = gdk_win32_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index c76f3a3..63620e7 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -28,26 +28,11 @@
typedef struct _GdkWindowQueueItem GdkWindowQueueItem;
typedef struct _GdkWindowParentPos GdkWindowParentPos;
-typedef enum {
- GDK_WINDOW_QUEUE_TRANSLATE,
- GDK_WINDOW_QUEUE_ANTIEXPOSE
-} GdkWindowQueueType;
-
struct _GdkWindowQueueItem
{
GdkWindow *window;
gulong serial;
- GdkWindowQueueType type;
- union {
- struct {
- cairo_region_t *area;
- gint dx;
- gint dy;
- } translate;
- struct {
- cairo_region_t *area;
- } antiexpose;
- } u;
+ cairo_region_t *antiexpose_area;
};
void
@@ -140,14 +125,7 @@ queue_item_free (GdkWindowQueueItem *item)
(gpointer *)&(item->window));
}
- if (item->type == GDK_WINDOW_QUEUE_ANTIEXPOSE)
- cairo_region_destroy (item->u.antiexpose.area);
- else
- {
- if (item->u.translate.area)
- cairo_region_destroy (item->u.translate.area);
- }
-
+ cairo_region_destroy (item->antiexpose_area);
g_free (item);
}
@@ -213,11 +191,8 @@ gdk_window_queue (GdkWindow *window,
GdkWindowQueueItem *item = tmp_list->data;
GList *next = tmp_list->next;
- if (item->type == GDK_WINDOW_QUEUE_ANTIEXPOSE)
- {
- queue_delete_link (display_x11->translate_queue, tmp_list);
- queue_item_free (item);
- }
+ queue_delete_link (display_x11->translate_queue, tmp_list);
+ queue_item_free (item);
tmp_list = next;
}
@@ -232,86 +207,12 @@ gdk_window_queue (GdkWindow *window,
g_queue_push_tail (display_x11->translate_queue, item);
}
-static GC
-_get_scratch_gc (GdkWindow *window, cairo_region_t *clip_region)
-{
- GdkX11Screen *screen;
- XRectangle *rectangles;
- gint n_rects;
- gint depth;
-
- screen = GDK_X11_SCREEN (gdk_window_get_screen (window));
- depth = gdk_visual_get_depth (gdk_window_get_visual (window)) - 1;
-
- if (!screen->subwindow_gcs[depth])
- {
- XGCValues values;
-
- values.graphics_exposures = True;
- values.subwindow_mode = IncludeInferiors;
-
- screen->subwindow_gcs[depth] = XCreateGC (screen->xdisplay,
- GDK_WINDOW_XID (window),
- GCSubwindowMode | GCGraphicsExposures,
- &values);
- }
-
- _gdk_x11_region_get_xrectangles (clip_region,
- 0, 0,
- &rectangles,
- &n_rects);
-
- XSetClipRectangles (screen->xdisplay,
- screen->subwindow_gcs[depth],
- 0, 0,
- rectangles, n_rects,
- YXBanded);
-
- g_free (rectangles);
- return screen->subwindow_gcs[depth];
-}
-
-
-
-void
-_gdk_x11_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- GdkWindowQueueItem *item;
- GC xgc;
- GdkRectangle extents;
-
- cairo_region_get_extents (area, &extents);
-
- xgc = _get_scratch_gc (window, area);
-
- cairo_region_translate (area, -dx, -dy); /* Move to source region */
-
- item = g_new (GdkWindowQueueItem, 1);
- item->type = GDK_WINDOW_QUEUE_TRANSLATE;
- item->u.translate.area = cairo_region_copy (area);
- item->u.translate.dx = dx;
- item->u.translate.dy = dy;
- gdk_window_queue (window, item);
-
- XCopyArea (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window),
- GDK_WINDOW_XID (window),
- xgc,
- extents.x - dx, extents.y - dy,
- extents.width, extents.height,
- extents.x, extents.y);
-}
-
gboolean
_gdk_x11_window_queue_antiexpose (GdkWindow *window,
cairo_region_t *area)
{
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
- item->type = GDK_WINDOW_QUEUE_ANTIEXPOSE;
- item->u.antiexpose.area = area;
+ item->antiexpose_area = area;
gdk_window_queue (window, item);
@@ -339,28 +240,7 @@ _gdk_x11_window_process_expose (GdkWindow *window,
if (serial - item->serial > (gulong) G_MAXLONG)
{
if (item->window == window)
- {
- if (item->type == GDK_WINDOW_QUEUE_TRANSLATE)
- {
- if (item->u.translate.area)
- {
- cairo_region_t *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
- cairo_region_translate (invalidate_region, item->u.translate.dx,
item->u.translate.dy);
- }
- else /* anti-expose */
- {
- cairo_region_subtract (invalidate_region, item->u.antiexpose.area);
- }
- }
+ cairo_region_subtract (invalidate_region, item->antiexpose_area);
}
else
{
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 39298ad..6f3a8eb 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5334,7 +5334,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->input_shape_combine_region = gdk_window_x11_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_x11_set_static_gravities;
impl_class->queue_antiexpose = _gdk_x11_window_queue_antiexpose;
- impl_class->translate = _gdk_x11_window_translate;
impl_class->destroy = gdk_x11_window_destroy;
impl_class->destroy_foreign = gdk_x11_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_x11_resize_cairo_surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]