gpu: Move gc calls further to the edges of the function

Make the function look like that:

1. handle special case
2. maybe GC
3. draw
4. queue next gc
5. cleanup

This seems like the sanest approach to avoid gc() collecting things
necessary for drawing in the future.

And I need to refactor stuff, so having it out of the way is a good
idea.
This commit is contained in:
Benjamin Otte 2024-07-17 20:15:26 +02:00
parent d21ac80178
commit 3cf5e8cf4e

View File

@ -416,12 +416,12 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
return;
}
gsk_gpu_device_maybe_gc (priv->device);
depth = gsk_render_node_get_preferred_depth (root);
gdk_draw_context_begin_frame_full (priv->context, depth, region);
gsk_gpu_device_maybe_gc (priv->device);
gsk_gpu_renderer_make_current (self);
backbuffer = GSK_GPU_RENDERER_GET_CLASS (self)->get_backbuffer (self);
@ -443,10 +443,10 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
),
NULL);
gsk_gpu_device_queue_gc (priv->device);
gdk_draw_context_end_frame (priv->context);
gsk_gpu_device_queue_gc (priv->device);
g_clear_pointer (&render_region, cairo_region_destroy);
}