summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-05-10 00:08:24 +0200
committerBenjamin Otte <otte@redhat.com>2023-05-17 02:25:32 +0200
commit860c82d57648a1c64a178ab30c6d1ffcf07b5055 (patch)
tree01729e187753b2ccad48b6888ec37bff9435ff63
parent4948f675fa4194366f6b1b57a710f68bf617f913 (diff)
downloadgtk+-860c82d57648a1c64a178ab30c6d1ffcf07b5055.tar.gz
vulkan: Handle empty child bounds in repeat node
Also add test to the testsuite for it.
-rw-r--r--gsk/vulkan/gskvulkanimage.c2
-rw-r--r--gsk/vulkan/gskvulkanrenderpass.c3
-rw-r--r--testsuite/gsk/compare/repeat-empty-child-bounds.node24
-rw-r--r--testsuite/gsk/compare/repeat-empty-child-bounds.pngbin0 -> 119 bytes
-rw-r--r--testsuite/gsk/meson.build1
5 files changed, 30 insertions, 0 deletions
diff --git a/gsk/vulkan/gskvulkanimage.c b/gsk/vulkan/gskvulkanimage.c
index b6b44ecc8c..5888cb0a23 100644
--- a/gsk/vulkan/gskvulkanimage.c
+++ b/gsk/vulkan/gskvulkanimage.c
@@ -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);
diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c
index 556502af7a..0b1d431161 100644
--- a/gsk/vulkan/gskvulkanrenderpass.c
+++ b/gsk/vulkan/gskvulkanrenderpass.c
@@ -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)
diff --git a/testsuite/gsk/compare/repeat-empty-child-bounds.node b/testsuite/gsk/compare/repeat-empty-child-bounds.node
new file mode 100644
index 0000000000..b2dee849f3
--- /dev/null
+++ b/testsuite/gsk/compare/repeat-empty-child-bounds.node
@@ -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);
+ }
+}
diff --git a/testsuite/gsk/compare/repeat-empty-child-bounds.png b/testsuite/gsk/compare/repeat-empty-child-bounds.png
new file mode 100644
index 0000000000..1cf45d8688
--- /dev/null
+++ b/testsuite/gsk/compare/repeat-empty-child-bounds.png
Binary files differ
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index 263d13cf29..df493d9332 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -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',