From 7f61d7ac8b3c3be030fa85efc618ded4e8ef78cf Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 7 Jul 2024 07:36:09 +0200 Subject: [PATCH] gpu: Implement get_node_as_image() for subsurface nodes Pass through to the child instead of offscreening. I mainly implemented it for the assertion, because this might be a sneaky way to introduce bugs without exhaustive checking that we don't offload stuff that is offscreened. No actual bugs that I'm aware of, so no tests. Strictly defensive coding. --- gsk/gpu/gskgpunodeprocessor.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index 83a3b2f9b5..6e5387bf0b 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -2878,6 +2878,29 @@ gsk_gpu_node_processor_add_subsurface_node (GskGpuNodeProcessor *self, } } +static GskGpuImage * +gsk_gpu_get_subsurface_node_as_image (GskGpuFrame *frame, + const graphene_rect_t *clip_bounds, + const graphene_vec2_t *scale, + GskRenderNode *node, + graphene_rect_t *out_bounds) +{ +#ifndef G_DISABLE_ASSERT + GdkSubsurface *subsurface; + + subsurface = gsk_subsurface_node_get_subsurface (node); + g_assert (subsurface == NULL || + gdk_subsurface_get_texture (subsurface) == NULL || + gdk_subsurface_get_parent (subsurface) != gdk_draw_context_get_surface (gsk_gpu_frame_get_context (frame))); +#endif + + return gsk_gpu_get_node_as_image (frame, + clip_bounds, + scale, + gsk_subsurface_node_get_child (node), + out_bounds); +} + static void gsk_gpu_node_processor_add_container_node (GskGpuNodeProcessor *self, GskRenderNode *node) @@ -3113,7 +3136,7 @@ static const struct GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP | GSK_GPU_GLOBAL_SCISSOR | GSK_GPU_GLOBAL_BLEND, GSK_GPU_HANDLE_OPACITY, gsk_gpu_node_processor_add_subsurface_node, - NULL, + gsk_gpu_get_subsurface_node_as_image, }, };