summaryrefslogtreecommitdiff
path: root/gsk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-07-24 18:30:36 +0200
committerTimm Bäder <mail@baedert.org>2020-07-28 05:34:12 +0200
commit0ce32cd4b5d4f736c9e3a2540c30115c3b70dad0 (patch)
tree5d4493907f9ebd8ed1bc73f65ebf25f7e20db1ee /gsk
parent756b84033a92e6181019c948e6e0e0a59ad2f046 (diff)
downloadgtk+-0ce32cd4b5d4f736c9e3a2540c30115c3b70dad0.tar.gz
gl renderer: Save rectilinearity in clip stack
So we don't have to repeatedly call it in pop_clip()
Diffstat (limited to 'gsk')
-rw-r--r--gsk/gl/gskglrenderops.c28
-rw-r--r--gsk/gl/gskglrenderopsprivate.h2
2 files changed, 20 insertions, 10 deletions
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index bcee21a659..0a59026577 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -1,6 +1,12 @@
#include "gskglrenderopsprivate.h"
#include "gsktransform.h"
+typedef struct
+{
+ GskRoundedRect rect;
+ bool is_rectilinear;
+} ClipStackEntry;
+
static inline gboolean
rect_equal (const graphene_rect_t *a,
const graphene_rect_t *b)
@@ -310,33 +316,37 @@ void
ops_push_clip (RenderOpBuilder *self,
const GskRoundedRect *clip)
{
+ ClipStackEntry entry;
+
if (G_UNLIKELY (self->clip_stack == NULL))
- self->clip_stack = g_array_new (FALSE, TRUE, sizeof (GskRoundedRect));
+ self->clip_stack = g_array_new (FALSE, TRUE, sizeof (ClipStackEntry));
g_assert (self->clip_stack != NULL);
- g_array_append_val (self->clip_stack, *clip);
- self->current_clip = &g_array_index (self->clip_stack, GskRoundedRect, self->clip_stack->len - 1);
- self->clip_is_rectilinear = gsk_rounded_rect_is_rectilinear (self->current_clip);
+ entry.rect = *clip;
+ entry.is_rectilinear = gsk_rounded_rect_is_rectilinear (clip);
+ g_array_append_val (self->clip_stack, entry);
+ self->current_clip = &g_array_index (self->clip_stack, ClipStackEntry, self->clip_stack->len - 1).rect;
+ self->clip_is_rectilinear = entry.is_rectilinear;
ops_set_clip (self, clip);
}
void
ops_pop_clip (RenderOpBuilder *self)
{
- const GskRoundedRect *head;
+ const ClipStackEntry *head;
g_assert (self->clip_stack);
g_assert (self->clip_stack->len >= 1);
self->clip_stack->len --;
- head = &g_array_index (self->clip_stack, GskRoundedRect, self->clip_stack->len - 1);
+ head = &g_array_index (self->clip_stack, ClipStackEntry, self->clip_stack->len - 1);
if (self->clip_stack->len >= 1)
{
- self->current_clip = head;
- self->clip_is_rectilinear = gsk_rounded_rect_is_rectilinear (self->current_clip);
- ops_set_clip (self, head);
+ self->current_clip = &head->rect;
+ self->clip_is_rectilinear = head->is_rectilinear;
+ ops_set_clip (self, &head->rect);
}
else
{
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index 0a8bf557f9..de8b30ddd9 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -188,7 +188,7 @@ typedef struct
GArray *clip_stack;
/* Pointer into clip_stack */
const GskRoundedRect *current_clip;
- guint clip_is_rectilinear;
+ bool clip_is_rectilinear;
} RenderOpBuilder;