mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
gl renderer: Ignore viewport ops to the same viewport
This commit is contained in:
parent
82a1d4f280
commit
df817bd118
@ -1,5 +1,12 @@
|
|||||||
#include "gskglrenderopsprivate.h"
|
#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
|
void
|
||||||
ops_finish (RenderOpBuilder *builder)
|
ops_finish (RenderOpBuilder *builder)
|
||||||
{
|
{
|
||||||
@ -188,8 +195,8 @@ ops_set_program (RenderOpBuilder *builder,
|
|||||||
program_state->modelview = *builder->current_modelview;
|
program_state->modelview = *builder->current_modelview;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp (&empty_rect, &program_state->viewport, sizeof (graphene_rect_t)) == 0 ||
|
if (rect_equal (&empty_rect, &program_state->viewport) ||
|
||||||
memcmp (&builder->current_viewport, &program_state->viewport, sizeof (graphene_rect_t)) != 0)
|
!rect_equal (&builder->current_viewport, &program_state->viewport))
|
||||||
{
|
{
|
||||||
op.op = OP_CHANGE_VIEWPORT;
|
op.op = OP_CHANGE_VIEWPORT;
|
||||||
op.viewport = builder->current_viewport;
|
op.viewport = builder->current_viewport;
|
||||||
@ -376,6 +383,10 @@ ops_set_viewport (RenderOpBuilder *builder,
|
|||||||
RenderOp op;
|
RenderOp op;
|
||||||
graphene_rect_t prev_viewport;
|
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.op = OP_CHANGE_VIEWPORT;
|
||||||
op.viewport = *viewport;
|
op.viewport = *viewport;
|
||||||
g_array_append_val (builder->render_ops, op);
|
g_array_append_val (builder->render_ops, op);
|
||||||
|
Loading…
Reference in New Issue
Block a user