vulkan: Handle empty child bounds in repeat node

Also add test to the testsuite for it.
This commit is contained in:
Benjamin Otte 2023-05-10 00:08:24 +02:00
parent da147dca92
commit 7f1bd1f047
5 changed files with 30 additions and 0 deletions

View File

@ -209,6 +209,8 @@ gsk_vulkan_image_new (GdkVulkanContext *context,
VkMemoryRequirements requirements;
GskVulkanImage *self;
g_assert (width > 0 && height > 0);
self = g_object_new (GSK_TYPE_VULKAN_IMAGE, NULL);
self->vulkan = g_object_ref (context);

View File

@ -725,6 +725,9 @@ gsk_vulkan_render_pass_add_repeat_node (GskVulkanRenderPass *self,
.render.node = node
};
if (graphene_rect_get_area (gsk_repeat_node_get_child_bounds (node)) == 0)
return TRUE;
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE;
else if (constants->clip.type == GSK_VULKAN_CLIP_RECT)

View File

@ -0,0 +1,24 @@
repeat {
bounds: 0 0 100 100;
child-bounds: 0 0 0 0;
child: color {
bounds: 0 0 20 20;
color: rgb(255,0,0);
}
}
repeat {
bounds: 0 0 100 100;
child-bounds: 0 0 20 0;
child: color {
bounds: 0 0 20 20;
color: rgb(0,128,0);
}
}
repeat {
bounds: 0 0 100 100;
child-bounds: 0 0 0 20;
child: color {
bounds: 0 0 20 20;
color: rgb(0,0,255);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

View File

@ -77,6 +77,7 @@ compare_render_tests = [
'outset_shadow_simple',
'repeat',
'repeat-no-repeat',
'repeat-empty-child-bounds',
'repeat-negative-coords',
'repeat-texture',
'scale-textures-negative-ngl',