[gtk] gl renderer: Ignore viewport ops to the same viewport
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gl renderer: Ignore viewport ops to the same viewport
- Date: Fri, 7 Dec 2018 16:10:25 +0000 (UTC)
commit df817bd118cf3f51b154564a22fdeb91ba8120e9
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 5 10:36:43 2018 +0100
gl renderer: Ignore viewport ops to the same viewport
gsk/gl/gskglrenderops.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index ace761790c..dc85c2e8f5 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -1,5 +1,12 @@
#include "gskglrenderopsprivate.h"
+static inline gboolean
+rect_equal (const graphene_rect_t *a,
+ const graphene_rect_t *b)
+{
+ return memcmp (a, b, sizeof (graphene_rect_t)) == 0;
+}
+
void
ops_finish (RenderOpBuilder *builder)
{
@@ -188,8 +195,8 @@ ops_set_program (RenderOpBuilder *builder,
program_state->modelview = *builder->current_modelview;
}
- if (memcmp (&empty_rect, &program_state->viewport, sizeof (graphene_rect_t)) == 0 ||
- memcmp (&builder->current_viewport, &program_state->viewport, sizeof (graphene_rect_t)) != 0)
+ if (rect_equal (&empty_rect, &program_state->viewport) ||
+ !rect_equal (&builder->current_viewport, &program_state->viewport))
{
op.op = OP_CHANGE_VIEWPORT;
op.viewport = builder->current_viewport;
@@ -376,6 +383,10 @@ ops_set_viewport (RenderOpBuilder *builder,
RenderOp op;
graphene_rect_t prev_viewport;
+ if (builder->current_program_state != NULL &&
+ rect_equal (&builder->current_program_state->viewport, viewport))
+ return builder->current_program_state->viewport;
+
op.op = OP_CHANGE_VIEWPORT;
op.viewport = *viewport;
g_array_append_val (builder->render_ops, op);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]