vulkan: Change the clip intersection check

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.
This commit is contained in:
Benjamin Otte 2023-07-11 01:38:02 +02:00
parent 5c601b673e
commit 3523d56122
3 changed files with 6 additions and 8 deletions

View File

@ -236,9 +236,9 @@ gsk_vulkan_clip_transform (GskVulkanClip *dest,
} }
gboolean gboolean
gsk_vulkan_clip_intersects_rect (const GskVulkanClip *self, gsk_vulkan_clip_may_intersect_rect (const GskVulkanClip *self,
const graphene_point_t *offset, const graphene_point_t *offset,
const graphene_rect_t *rect) const graphene_rect_t *rect)
{ {
graphene_rect_t r = *rect; graphene_rect_t r = *rect;
r.origin.x += offset->x; 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_NONE:
case GSK_VULKAN_CLIP_RECT: case GSK_VULKAN_CLIP_RECT:
return graphene_rect_intersection (&self->rect.bounds, &r, NULL);
case GSK_VULKAN_CLIP_ROUNDED: case GSK_VULKAN_CLIP_ROUNDED:
return gsk_rounded_rect_intersects_rect (&self->rect, &r); return graphene_rect_intersection (&self->rect.bounds, &r, NULL);
} }
} }

View File

@ -55,7 +55,7 @@ gboolean gsk_vulkan_clip_transform (GskVulk
gboolean gsk_vulkan_clip_contains_rect (const GskVulkanClip *self, gboolean gsk_vulkan_clip_contains_rect (const GskVulkanClip *self,
const graphene_point_t *offset, const graphene_point_t *offset,
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT; 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_point_t *offset,
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT; const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;

View 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 /* 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 */ * 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; return;
node_type = gsk_render_node_get_node_type (node); node_type = gsk_render_node_get_node_type (node);