mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
generic damage generation for offscreen windows
Generating damage from gdk drawing api doesn't help for cairo rendering ...and the gdk drawing api is gone anyway. Bug 621571
This commit is contained in:
parent
7fd148fc59
commit
075661d376
@ -209,45 +209,6 @@ gdk_offscreen_window_get_visual (GdkDrawable *drawable)
|
||||
return gdk_drawable_get_visual (offscreen->wrapper);
|
||||
}
|
||||
|
||||
static void
|
||||
add_damage (GdkOffscreenWindow *offscreen,
|
||||
int x, int y,
|
||||
int w, int h,
|
||||
gboolean is_line)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
cairo_region_t *damage;
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
|
||||
if (is_line)
|
||||
{
|
||||
/* This should really take into account line width, line
|
||||
* joins (and miter) and line caps. But these are hard
|
||||
* to compute, rarely used and generally a pain. And in
|
||||
* the end a snug damage rectangle is not that important
|
||||
* as multiple damages are generally created anyway.
|
||||
*
|
||||
* So, we just add some padding around the rect.
|
||||
* We use a padding of 3 pixels, plus an extra row
|
||||
* below and on the right for the normal line size. I.E.
|
||||
* line from (0,0) to (2,0) gets h=0 but is really
|
||||
* at least one pixel tall.
|
||||
*/
|
||||
rect.x -= 3;
|
||||
rect.y -= 3;
|
||||
rect.width += 7;
|
||||
rect.height += 7;
|
||||
}
|
||||
|
||||
damage = cairo_region_create_rectangle (&rect);
|
||||
_gdk_window_add_damage (offscreen->wrapper, damage);
|
||||
cairo_region_destroy (damage);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
|
@ -4305,6 +4305,10 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
|
||||
if (cairo_region_is_empty (expose_region))
|
||||
return;
|
||||
|
||||
if (gdk_window_is_offscreen (private->impl_window) &&
|
||||
private == private->impl_window)
|
||||
_gdk_window_add_damage ((GdkWindow *) private->impl_window, expose_region);
|
||||
|
||||
/* Make this reentrancy safe for expose handlers freeing windows */
|
||||
children = g_list_copy (private->children);
|
||||
g_list_foreach (children, (GFunc)g_object_ref, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user