[gtk] gl renderer: Track border width state separately
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gl renderer: Track border width state separately
- Date: Fri, 7 Dec 2018 16:10:35 +0000 (UTC)
commit 3ce45508e122f7fba8d6f6bf85ca4a96499b3ea2
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 5 10:44:11 2018 +0100
gl renderer: Track border width state separately
gsk/gl/gskglrenderer.c | 21 +++++++++++++++++----
gsk/gl/gskglrenderops.c | 28 ++++++++++++++++++++--------
gsk/gl/gskglrenderopsprivate.h | 14 ++++++++------
3 files changed, 45 insertions(+), 18 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 693faafe8f..ff66e803e9 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -663,7 +663,8 @@ render_border_node (GskGLRenderer *self,
}
ops_set_program (builder, &self->border_program);
- ops_set_border (builder, widths, &outline);
+ ops_set_border_width (builder, widths);
+ ops_set_border (builder, &outline);
for (i = 0; i < 4; i ++)
{
@@ -1879,8 +1880,7 @@ apply_border_op (const Program *program,
float widths[4];
float heights[4];
int i;
- OP_PRINT (" -> Border (%f, %f, %f, %f)",
- op->border.widths[0], op->border.widths[1], op->border.widths[2], op->border.widths[3]);
+ OP_PRINT (" -> Border Outline");
outline[0] = o->bounds.origin.x;
outline[1] = o->bounds.origin.y;
@@ -1893,12 +1893,21 @@ apply_border_op (const Program *program,
heights[i] = o->corner[i].height;
}
- glUniform4fv (program->border.widths_location, 1, op->border.widths);
glUniform4fv (program->border.outline_location, 1, outline);
glUniform4fv (program->border.corner_widths_location, 1, widths);
glUniform4fv (program->border.corner_heights_location, 1, heights);
}
+static inline void
+apply_border_width_op (const Program *program,
+ const RenderOp *op)
+{
+ OP_PRINT (" -> Border width (%f, %f, %f, %f)",
+ op->border.widths[0], op->border.widths[1], op->border.widths[2], op->border.widths[3]);
+
+ glUniform4fv (program->border.widths_location, 1, op->border.widths);
+}
+
static inline void
apply_border_color_op (const Program *program,
const RenderOp *op)
@@ -2608,6 +2617,10 @@ gsk_gl_renderer_render_ops (GskGLRenderer *self,
apply_border_op (program, op);
break;
+ case OP_CHANGE_BORDER_WIDTH:
+ apply_border_width_op (program, op);
+ break;
+
case OP_CHANGE_UNBLURRED_OUTSET_SHADOW:
apply_unblurred_outset_shadow_op (program, op);
break;
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 9b2e299ebe..db77ea7c68 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -537,28 +537,40 @@ ops_set_color_matrix (RenderOpBuilder *builder,
void
ops_set_border (RenderOpBuilder *builder,
- const float *widths,
const GskRoundedRect *outline)
{
RenderOp op;
- if (memcmp (&builder->current_program_state->border.widths,
- widths, sizeof (float) * 4) == 0 &&
- memcmp (&builder->current_program_state->border.outline,
+ if (memcmp (&builder->current_program_state->border.outline,
outline, sizeof (GskRoundedRect)) == 0)
return;
- memcpy (&builder->program_state[builder->current_program->index].border.widths,
- widths, sizeof (float) * 4);
-
builder->current_program_state->border.outline = *outline;
op.op = OP_CHANGE_BORDER;
+ op.border.outline = *outline;
+ g_array_append_val (builder->render_ops, op);
+}
+
+void
+ops_set_border_width (RenderOpBuilder *builder,
+ const float *widths)
+{
+ RenderOp op;
+
+ if (memcmp (builder->current_program_state->border.widths,
+ widths, sizeof (float) * 4) == 0)
+ return;
+
+ memcpy (&builder->current_program_state->border.widths,
+ widths, sizeof (float) * 4);
+
+ op.op = OP_CHANGE_BORDER_WIDTH;
op.border.widths[0] = widths[0];
op.border.widths[1] = widths[1];
op.border.widths[2] = widths[2];
op.border.widths[3] = widths[3];
- op.border.outline = *outline;
+
g_array_append_val (builder->render_ops, op);
}
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index c4bf2b29b9..1d1594172d 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -50,11 +50,12 @@ enum {
OP_CHANGE_OUTSET_SHADOW = 15,
OP_CHANGE_BORDER = 16,
OP_CHANGE_BORDER_COLOR = 17,
- OP_CHANGE_CROSS_FADE = 18,
- OP_CHANGE_UNBLURRED_OUTSET_SHADOW = 19,
- OP_CLEAR = 20,
- OP_DRAW = 21,
- OP_DUMP_FRAMEBUFFER = 22,
+ OP_CHANGE_BORDER_WIDTH = 18,
+ OP_CHANGE_CROSS_FADE = 19,
+ OP_CHANGE_UNBLURRED_OUTSET_SHADOW = 20,
+ OP_CLEAR = 21,
+ OP_DRAW = 22,
+ OP_DUMP_FRAMEBUFFER = 23,
};
typedef struct
@@ -310,8 +311,9 @@ void ops_set_color_matrix (RenderOpBuilder *builder,
const graphene_vec4_t *offset);
void ops_set_border (RenderOpBuilder *builder,
- const float *widths,
const GskRoundedRect *outline);
+void ops_set_border_width (RenderOpBuilder *builder,
+ const float *widths);
void ops_set_border_color (RenderOpBuilder *builder,
const GdkRGBA *color);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]