[gtk/wip/baedert/for-master: 2/3] gl renderer: Unify viewport setting in add_offscreen_ops()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 2/3] gl renderer: Unify viewport setting in add_offscreen_ops()
- Date: Tue, 15 Dec 2020 14:09:00 +0000 (UTC)
commit 59520420f0a999c0412d342c3ac60a05019a5fc1
Author: Timm Bäder <mail baedert org>
Date: Sat Dec 12 14:45:11 2020 +0100
gl renderer: Unify viewport setting in add_offscreen_ops()
We use the same rect here a few times.
gsk/gl/gskglrenderer.c | 21 +++++++--------------
gsk/gskroundedrectprivate.h | 10 ++++++++++
2 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 1731b7ca46..0b7a45800c 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -3839,6 +3839,7 @@ add_offscreen_ops (GskGLRenderer *self,
int filter;
GskTextureKey key;
int cached_id;
+ graphene_rect_t viewport;
if (node_is_invisible (child_node))
{
@@ -3924,27 +3925,19 @@ add_offscreen_ops (GskGLRenderer *self,
render_target);
}
- init_projection_matrix (&item_proj,
- &GRAPHENE_RECT_INIT (
- bounds->origin.x * scale_x,
- bounds->origin.y * scale_y,
- width, height
- ));
+ viewport = GRAPHENE_RECT_INIT (bounds->origin.x * scale_x,
+ bounds->origin.y * scale_y,
+ width, height);
+ init_projection_matrix (&item_proj, &viewport);
prev_render_target = ops_set_render_target (builder, render_target);
/* Clear since we use this rendertarget for the first time */
ops_begin (builder, OP_CLEAR);
prev_projection = ops_set_projection (builder, &item_proj);
ops_set_modelview (builder, gsk_transform_scale (NULL, scale_x, scale_y));
- prev_viewport = ops_set_viewport (builder,
- &GRAPHENE_RECT_INIT (bounds->origin.x * scale_x,
- bounds->origin.y * scale_y,
- width, height));
+ prev_viewport = ops_set_viewport (builder, &viewport);
if (flags & RESET_CLIP)
- ops_push_clip (builder,
- &GSK_ROUNDED_RECT_INIT (bounds->origin.x * scale_x,
- bounds->origin.y * scale_y,
- width, height));
+ ops_push_clip (builder, &GSK_ROUNDED_RECT_INIT_FROM_RECT (viewport));
builder->dx = 0;
builder->dy = 0;
diff --git a/gsk/gskroundedrectprivate.h b/gsk/gskroundedrectprivate.h
index 5c2912b492..bddd4ea18c 100644
--- a/gsk/gskroundedrectprivate.h
+++ b/gsk/gskroundedrectprivate.h
@@ -7,6 +7,16 @@
G_BEGIN_DECLS
+#define GSK_ROUNDED_RECT_INIT_FROM_RECT(_r) \
+ (GskRoundedRect) { .bounds = _r, \
+ .corner = { \
+ GRAPHENE_SIZE_INIT(0, 0),\
+ GRAPHENE_SIZE_INIT(0, 0),\
+ GRAPHENE_SIZE_INIT(0, 0),\
+ GRAPHENE_SIZE_INIT(0, 0),\
+ }}
+
+
gboolean gsk_rounded_rect_is_circular (const GskRoundedRect *self);
void gsk_rounded_rect_path (const GskRoundedRect *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]