gsk: Change the clear op api

A clear op is just a fancy memcpy. Make it the callers responsibility
to convert the color to the right color state before passing it
to the clear op.
This commit is contained in:
Matthias Clasen 2024-08-02 10:16:40 -04:00
parent f9612533c2
commit 9eebe8e547
3 changed files with 11 additions and 13 deletions

View File

@ -104,14 +104,13 @@ static const GskGpuOpClass GSK_GPU_CLEAR_OP_CLASS = {
void
gsk_gpu_clear_op (GskGpuFrame *frame,
GdkColorState *ccs,
const cairo_rectangle_int_t *rect,
const GdkRGBA *color)
const float color[4])
{
GskGpuClearOp *self;
self = (GskGpuClearOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_CLEAR_OP_CLASS);
self->rect = *rect;
gdk_color_state_from_rgba (ccs, color, self->color);
memcpy (self->color, color, sizeof (float) * 4);
}

View File

@ -1,13 +1,13 @@
#pragma once
#include "gskgputypesprivate.h"
#include "gskgpucolorstatesprivate.h"
G_BEGIN_DECLS
void gsk_gpu_clear_op (GskGpuFrame *frame,
GdkColorState *ccs,
const cairo_rectangle_int_t *rect,
const GdkRGBA *color);
const float color[4]);
G_END_DECLS

View File

@ -1471,6 +1471,7 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
cairo_rectangle_int_t int_clipped;
graphene_rect_t rect, clipped;
const GdkRGBA *color;
float clear_color[4];
color = gsk_color_node_get_color (node);
graphene_rect_offset_r (&node->bounds,
@ -1568,10 +1569,8 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
}
}
gsk_gpu_clear_op (self->frame,
self->ccs,
&int_clipped,
color);
gdk_color_state_from_rgba (self->ccs, color, clear_color);
gsk_gpu_clear_op (self->frame, &int_clipped, clear_color);
return;
}
@ -3322,10 +3321,10 @@ gsk_gpu_node_processor_add_subsurface_node (GskGpuNodeProcessor *self,
{
if (gdk_rectangle_intersect (&int_clipped, &self->scissor, &int_clipped))
{
gsk_gpu_clear_op (self->frame,
GDK_COLOR_STATE_SRGB,
&int_clipped,
&GDK_RGBA_TRANSPARENT);
float color[4];
gdk_color_state_from_rgba (self->ccs, &GDK_RGBA_TRANSPARENT, color);
gsk_gpu_clear_op (self->frame, &int_clipped, color);
}
}
else