Merge branch 'wip/otte/for-main' into 'main'

rendernode: Implement diff() for repeat nodes

Closes #6389

See merge request GNOME/gtk!6842
This commit is contained in:
Benjamin Otte 2024-02-04 21:15:49 +00:00
commit 9216779963
6 changed files with 48 additions and 1 deletions

View File

@ -31,6 +31,7 @@ gsk_gpu_blur_op_print (GskGpuOp *op,
instance = (GskGpuBlurInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "blur");
g_string_append_printf (string, "%g,%g ", instance->blur_direction[0], instance->blur_direction[1]);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
gsk_gpu_print_newline (string);

View File

@ -1318,7 +1318,8 @@ gsk_gpu_node_processor_add_node_clipped (GskGpuNodeProcessor *self,
gsk_gpu_clip_init_copy (&self->clip, &old_clip);
return;
}
else if (self->clip.type == GSK_GPU_CLIP_RECT)
else if (self->clip.type == GSK_GPU_CLIP_RECT &&
gsk_rect_contains_rect (&self->clip.rect.bounds, &clip))
{
self->clip.type = GSK_GPU_CLIP_NONE;
}

View File

@ -4224,6 +4224,32 @@ gsk_repeat_node_draw (GskRenderNode *node,
}
}
static void
gsk_repeat_node_diff (GskRenderNode *node1,
GskRenderNode *node2,
GskDiffData *data)
{
GskRepeatNode *self1 = (GskRepeatNode *) node1;
GskRepeatNode *self2 = (GskRepeatNode *) node2;
if (gsk_rect_equal (&node1->bounds, &node2->bounds) &&
gsk_rect_equal (&self1->child_bounds, &self2->child_bounds))
{
cairo_region_t *sub;
sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) {sub, data->offload });
if (cairo_region_is_empty (sub))
{
cairo_region_destroy (sub);
return;
}
cairo_region_destroy (sub);
}
gsk_render_node_diff_impossible (node1, node2, data);
}
static void
gsk_repeat_node_class_init (gpointer g_class,
gpointer class_data)
@ -4234,6 +4260,7 @@ gsk_repeat_node_class_init (gpointer g_class,
node_class->finalize = gsk_repeat_node_finalize;
node_class->draw = gsk_repeat_node_draw;
node_class->diff = gsk_repeat_node_diff;
}
/**

View File

@ -0,0 +1,17 @@
/* make image larger so overdraw gets visible */
border {
outline: 0 0 50 50;
}
/* do a non-scissorable clip */
rounded-clip {
clip: 0 10 50 30 / 10;
/* do a scissorable clip that is larger
than the clip before */
child: clip {
clip: 10 0 30 50;
child: color {
color: blue;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

View File

@ -36,6 +36,7 @@ compare_render_tests = [
'clip-in-rounded-clip1',
'clip-in-rounded-clip2',
'clip-in-rounded-clip3',
'clip-in-smaller-rounded-clip',
'clip-intersection-fail-opacity-nogl',
'clipped-repeat',
'clipped_rounded_clip',