[gtk] gl renderer: Don't copy colors into render ops
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gl renderer: Don't copy colors into render ops
- Date: Fri, 11 Oct 2019 14:51:36 +0000 (UTC)
commit f7c64b4ebb213f7cb6a942317f7def6dc7cbe811
Author: Timm Bäder <mail baedert org>
Date: Fri Oct 11 15:06:51 2019 +0200
gl renderer: Don't copy colors into render ops
gsk/gl/gskglrenderer.c | 13 ++++++++++---
gsk/gl/gskglrenderops.c | 2 +-
gsk/gl/gskglrenderopsprivate.h | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 137f64d3ea..bcd221ac6b 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -23,6 +23,7 @@
#include "gdk/gdkgltextureprivate.h"
#include "gdk/gdkglcontextprivate.h"
#include "gdk/gdkprofilerprivate.h"
+#include "gdk/gdkrgbaprivate.h"
#include <epoxy/gl.h>
#include <cairo-ft.h>
@@ -398,8 +399,10 @@ add_rect_outline_ops (GskGLRenderer *self,
RenderOpBuilder *builder,
const graphene_rect_t *rect)
{
+ GdkRGBA *color = gdk_rgba_copy (&GDK_RGBA ("#F00")); /* Leaked */
+
ops_set_program (builder, &self->color_program);
- ops_set_color (builder, &(GdkRGBA) { 1, 0, 0, 1 });
+ ops_set_color (builder, color);
add_rect_ops (builder,
&GRAPHENE_RECT_INIT (rect->origin.x, rect->origin.y,
@@ -2122,9 +2125,13 @@ static inline void
apply_color_op (const Program *program,
const RenderOp *op)
{
- OP_PRINT (" -> Color: (%f, %f, %f, %f)", op->color.red, op->color.green, op->color.blue, op->color.alpha);
+ OP_PRINT (" -> Color: (%f, %f, %f, %f)",
+ op->color->red, op->color->green, op->color->blue, op->color->alpha);
glUniform4f (program->color.color_location,
- op->color.red, op->color.green, op->color.blue, op->color.alpha);
+ op->color->red,
+ op->color->green,
+ op->color->blue,
+ op->color->alpha);
}
static inline void
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index f7105f202a..98736bcaca 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -649,7 +649,7 @@ ops_set_color (RenderOpBuilder *builder,
current_program_state->color = *color;
op = ops_begin (builder, OP_CHANGE_COLOR);
- op->color = *color;
+ op->color = color;
}
void
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index 91ff2faa88..5f43eace61 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -159,7 +159,7 @@ typedef struct
const Program *program;
int texture_id;
int render_target_id;
- GdkRGBA color;
+ const GdkRGBA *color;
GskQuadVertex vertex_data[6];
GskRoundedRect clip;
graphene_rect_t viewport;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]