summaryrefslogtreecommitdiff
path: root/gsk/gl
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-07-24 17:18:18 +0200
committerTimm Bäder <mail@baedert.org>2020-07-28 05:34:12 +0200
commitd7ba281c15c62714baddb21b485431cc50e897d7 (patch)
treede9aa40238388b738ae5461351b7e2c320afeac5 /gsk/gl
parentc6c87b97c2bd997c11a307352f9ce2b171ab97e6 (diff)
downloadgtk+-d7ba281c15c62714baddb21b485431cc50e897d7.tar.gz
gl renderer: Add contains_rect helper
Diffstat (limited to 'gsk/gl')
-rw-r--r--gsk/gl/gskglrenderer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 62ad9f8b9f..78242df74f 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -216,6 +216,19 @@ graphene_rect_intersects (const graphene_rect_t *r1,
return true;
}
+static inline bool G_GNUC_PURE __attribute__((always_inline))
+_graphene_rect_contains_rect (const graphene_rect_t *r1,
+ const graphene_rect_t *r2)
+{
+ if (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))
+ return true;
+
+ return false;
+}
+
static inline void
sort_border_sides (const GdkRGBA *colors,
int *indices)
@@ -1183,13 +1196,13 @@ intersect_rounded_rectilinear (const graphene_rect_t *non_rounded,
graphene_rect_intersects (non_rounded,
&rounded_rect_corner (rounded, 3));
- if (corners[0] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 0)))
+ if (corners[0] && !_graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 0)))
return false;
- if (corners[1] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 1)))
+ if (corners[1] && !_graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 1)))
return false;
- if (corners[2] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 2)))
+ if (corners[2] && !_graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 2)))
return false;
- if (corners[3] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 3)))
+ if (corners[3] && !_graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 3)))
return false;
/* We do intersect with at least one of the corners, but in such a way that the