#include <gdk/gdkmemorytextureprivate.h>
#include <gsk/gsktransformprivate.h>
#include <gsk/gskroundedrectprivate.h>
+#include <gsk/gskrectprivate.h>
#include <math.h>
#include <string.h>
return !graphene_vec4_equal (graphene_vec4_w_axis (), &row3);
}
-static inline gboolean G_GNUC_PURE
-rect_contains_rect (const graphene_rect_t *r1,
- const graphene_rect_t *r2)
-{
- return r2->origin.x >= r1->origin.x &&
- (r2->origin.x + r2->size.width) <= (r1->origin.x + r1->size.width) &&
- r2->origin.y >= r1->origin.y &&
- (r2->origin.y + r2->size.height) <= (r1->origin.y + r1->size.height);
-}
-
-static inline gboolean G_GNUC_PURE
-rect_intersects (const graphene_rect_t *r1,
- const graphene_rect_t *r2)
-{
- /* Assume both rects are already normalized, as they usually are */
- if (r1->origin.x > (r2->origin.x + r2->size.width) ||
- (r1->origin.x + r1->size.width) < r2->origin.x)
- return FALSE;
- else if (r1->origin.y > (r2->origin.y + r2->size.height) ||
- (r1->origin.y + r1->size.height) < r2->origin.y)
- return FALSE;
- else
- return TRUE;
-}
-
static inline void
init_projection_matrix (graphene_matrix_t *projection,
const graphene_rect_t *viewport)
gsk_gl_render_job_transform_bounds (job, bounds, &transformed_bounds);
- if (!rect_intersects (&job->current_clip->rect.bounds, &transformed_bounds))
+ if (!gsk_rect_intersects (&job->current_clip->rect.bounds, &transformed_bounds))
{
/* Completely clipped away */
return FALSE;
if (job->current_clip->is_rectilinear)
{
- if (rect_contains_rect (&job->current_clip->rect.bounds, &transformed_bounds))
+ if (gsk_rect_contains_rect (&job->current_clip->rect.bounds, &transformed_bounds))
no_clip = TRUE;
else
rect_clip = TRUE;
slice_bounds.size.width = slice->rect.width * scale_x;
slice_bounds.size.height = slice->rect.height * scale_y;
- if (!graphene_rect_intersection (&slice_bounds, &viewport, NULL))
+ if (!gsk_rect_intersects (&slice_bounds, &viewport))
continue;
if (i > 0)
/* If the size of the repeat node is smaller than the size of the
* child node, we don't repeat at all and can just draw that part
* of the child texture... */
- if (rect_contains_rect (child_bounds, &node->bounds))
+ if (gsk_rect_contains_rect (child_bounds, &node->bounds))
{
gsk_gl_render_job_visit_clipped_child (job, child, &node->bounds);
return;
--- /dev/null
+#pragma once
+
+#include <graphene.h>
+
+static inline gboolean G_GNUC_PURE
+gsk_rect_contains_rect (const graphene_rect_t *r1,
+ const graphene_rect_t *r2)
+{
+ return r2->origin.x >= r1->origin.x &&
+ (r2->origin.x + r2->size.width) <= (r1->origin.x + r1->size.width) &&
+ r2->origin.y >= r1->origin.y &&
+ (r2->origin.y + r2->size.height) <= (r1->origin.y + r1->size.height);
+}
+
+static inline gboolean G_GNUC_PURE
+gsk_rect_intersects (const graphene_rect_t *r1,
+ const graphene_rect_t *r2)
+{
+ /* Assume both rects are already normalized, as they usually are */
+ if (r1->origin.x >= (r2->origin.x + r2->size.width) ||
+ (r1->origin.x + r1->size.width) <= r2->origin.x ||
+ r1->origin.y >= (r2->origin.y + r2->size.height) ||
+ (r1->origin.y + r1->size.height) <= r2->origin.y)
+ return FALSE;
+ else
+ return TRUE;
+}
+
#include "gskroundedrectprivate.h"
#include "gskdebugprivate.h"
+#include "gskrectprivate.h"
#include <math.h>
gsk_rounded_rect_intersects_rect (const GskRoundedRect *self,
const graphene_rect_t *rect)
{
- if (!graphene_rect_intersection (&self->bounds, rect, NULL))
+ if (!gsk_rect_intersects (&self->bounds, rect))
return FALSE;
/* If the bounding boxes intersect but the rectangles don't,
#include "gskvulkanclipprivate.h"
+#include "gskrectprivate.h"
#include "gskroundedrectprivate.h"
#include "gsktransform.h"
gsk_vulkan_clip_init_copy (dest, src);
return TRUE;
}
- if (!graphene_rect_intersection (rect, &src->rect.bounds, NULL))
+ if (!gsk_rect_intersects (rect, &src->rect.bounds))
{
dest->type = GSK_VULKAN_CLIP_ALL_CLIPPED;
return TRUE;
gsk_vulkan_clip_init_copy (dest, src);
return TRUE;
}
- if (!graphene_rect_intersection (&rounded->bounds, &src->rect.bounds, NULL))
+ if (!gsk_rect_intersects (&rounded->bounds, &src->rect.bounds))
{
dest->type = GSK_VULKAN_CLIP_ALL_CLIPPED;
return TRUE;
case GSK_VULKAN_CLIP_NONE:
case GSK_VULKAN_CLIP_RECT:
case GSK_VULKAN_CLIP_ROUNDED:
- return graphene_rect_intersection (&self->rect.bounds, &r, NULL);
+ return gsk_rect_intersects (&self->rect.bounds, &r);
}
}