gl renderer: Don't copy colors into render ops

This commit is contained in:
Timm Bäder 2019-10-11 15:06:51 +02:00
parent f4f060c843
commit f7c64b4ebb
3 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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;