mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
offload: Do diff collection later
We were collecting diffs based on the can_offload/can_raise information, but attaching the texture to the subsurface can fail (e.g. if its not a dmabuf texture), in which case can_offload turned out to be wrong. So move the diff collection to the end and do it based on the whether we actually succeeded in attaching the texture.
This commit is contained in:
parent
30afac9a6b
commit
f8e89f2224
@ -581,25 +581,6 @@ gsk_offload_new (GdkSurface *surface,
|
||||
|
||||
gdk_subsurface_get_rect (info->subsurface, &old_rect);
|
||||
|
||||
if (info->can_offload != (gdk_subsurface_get_texture (info->subsurface) != NULL) ||
|
||||
info->can_raise != gdk_subsurface_is_above_parent (info->subsurface) ||
|
||||
(info->can_offload && !gsk_rect_equal (&info->rect, &old_rect)))
|
||||
{
|
||||
/* We changed things, need to invalidate everything */
|
||||
cairo_rectangle_int_t int_rect;
|
||||
|
||||
if (info->can_offload)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&info->rect, &int_rect);
|
||||
cairo_region_union_rectangle (diff, &int_rect);
|
||||
}
|
||||
if (gdk_subsurface_get_texture (info->subsurface) != NULL)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&old_rect, &int_rect);
|
||||
cairo_region_union_rectangle (diff, &int_rect);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->can_offload)
|
||||
{
|
||||
if (info->can_raise)
|
||||
@ -629,6 +610,26 @@ gsk_offload_new (GdkSurface *surface,
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Raising subsurface %p", info->subsurface);
|
||||
info->is_above = TRUE;
|
||||
}
|
||||
|
||||
if (info->is_offloaded != info->was_offloaded ||
|
||||
info->is_above != info->was_above ||
|
||||
(info->is_offloaded && !gsk_rect_equal (&info->rect, &old_rect)))
|
||||
{
|
||||
/* We changed things, need to invalidate everything */
|
||||
cairo_rectangle_int_t int_rect;
|
||||
|
||||
if (info->is_offloaded)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&info->rect, &int_rect);
|
||||
cairo_region_union_rectangle (diff, &int_rect);
|
||||
}
|
||||
if (info->was_offloaded)
|
||||
{
|
||||
gsk_rect_to_cairo_grow (&old_rect, &int_rect);
|
||||
cairo_region_union_rectangle (diff, &int_rect);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
|
Loading…
Reference in New Issue
Block a user