vulkan: Change the clip intersection check
authorBenjamin Otte <otte@redhat.com>
Mon, 10 Jul 2023 23:38:02 +0000 (01:38 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 10 Jul 2023 23:39:25 +0000 (01:39 +0200)
Intersection with a roudned clip takes too long.

Instead, rename the function to may_intersect() to be clear about what
it does and then just intersect with the regular rectangle.

gsk/vulkan/gskvulkanclip.c
gsk/vulkan/gskvulkanclipprivate.h
gsk/vulkan/gskvulkanrenderpass.c

index bf8a2732e18bb825fab280ccd0ce6f9d335e1774..2784bdd7c2aefa4a752e829b3bee67c0fd0d3a06 100644 (file)
@@ -236,9 +236,9 @@ gsk_vulkan_clip_transform (GskVulkanClip         *dest,
 }
 
 gboolean
-gsk_vulkan_clip_intersects_rect (const GskVulkanClip    *self,
-                                 const graphene_point_t *offset,
-                                 const graphene_rect_t  *rect)
+gsk_vulkan_clip_may_intersect_rect (const GskVulkanClip    *self,
+                                    const graphene_point_t *offset,
+                                    const graphene_rect_t  *rect)
 {
   graphene_rect_t r = *rect;
   r.origin.x += offset->x;
@@ -253,10 +253,8 @@ gsk_vulkan_clip_intersects_rect (const GskVulkanClip    *self,
 
     case GSK_VULKAN_CLIP_NONE:
     case GSK_VULKAN_CLIP_RECT:
-      return graphene_rect_intersection (&self->rect.bounds, &r, NULL);
-
     case GSK_VULKAN_CLIP_ROUNDED:
-      return gsk_rounded_rect_intersects_rect (&self->rect, &r);
+      return graphene_rect_intersection (&self->rect.bounds, &r, NULL);
     }
 }
 
index f3cadfc3377c2c3b3b5869573d135ec6783abb96..9f39250ee8af213fc33c77623fbaf4243664a140 100644 (file)
@@ -55,7 +55,7 @@ gboolean                gsk_vulkan_clip_transform                       (GskVulk
 gboolean                gsk_vulkan_clip_contains_rect                   (const GskVulkanClip    *self,
                                                                          const graphene_point_t *offset,
                                                                          const graphene_rect_t  *rect) G_GNUC_WARN_UNUSED_RESULT;
-gboolean                gsk_vulkan_clip_intersects_rect                 (const GskVulkanClip    *self,
+gboolean                gsk_vulkan_clip_may_intersect_rect              (const GskVulkanClip    *self,
                                                                          const graphene_point_t *offset,
                                                                          const graphene_rect_t  *rect) G_GNUC_WARN_UNUSED_RESULT;
 
index 3e793e4600abf6fde9175e73dbdf0d4bbcae17d7..66a74174af87f5ea1ad06d2332442404ab4c8a35 100644 (file)
@@ -1195,7 +1195,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass       *self,
 
   /* This catches the corner cases of empty nodes, so after this check
    * there's quaranteed to be at least 1 pixel that needs to be drawn */
-  if (!gsk_vulkan_clip_intersects_rect (&state->clip, &state->offset, &node->bounds))
+  if (!gsk_vulkan_clip_may_intersect_rect (&state->clip, &state->offset, &node->bounds))
     return;
 
   node_type = gsk_render_node_get_node_type (node);