mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
Change box shadow op api
Pass the ccs, opacity and GdkColor and let the op decide about color conversions. Update all callers.
This commit is contained in:
parent
355890b421
commit
070ddcd14b
@ -76,24 +76,28 @@ static const GskGpuShaderOpClass GSK_GPU_BOX_SHADOW_OP_CLASS = {
|
||||
void
|
||||
gsk_gpu_box_shadow_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
GdkColorState *ccs,
|
||||
float opacity,
|
||||
const graphene_point_t *offset,
|
||||
gboolean inset,
|
||||
const graphene_rect_t *bounds,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *shadow_offset,
|
||||
float spread,
|
||||
float blur_radius,
|
||||
const graphene_point_t *offset,
|
||||
const float color[4])
|
||||
const GdkColor *color)
|
||||
{
|
||||
GskGpuBoxshadowInstance *instance;
|
||||
GdkColorState *alt;
|
||||
|
||||
/* Use border shader for no blurring */
|
||||
g_return_if_fail (blur_radius > 0.0f);
|
||||
|
||||
alt = gsk_gpu_color_states_find (ccs, color);
|
||||
|
||||
gsk_gpu_shader_op_alloc (frame,
|
||||
&GSK_GPU_BOX_SHADOW_OP_CLASS,
|
||||
color_states,
|
||||
gsk_gpu_color_states_create (ccs, TRUE, alt, FALSE),
|
||||
inset ? VARIATION_INSET : 0,
|
||||
clip,
|
||||
NULL,
|
||||
@ -102,7 +106,7 @@ gsk_gpu_box_shadow_op (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_rect_to_float (bounds, offset, instance->bounds);
|
||||
gsk_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_vec4_to_float (color, instance->color);
|
||||
gsk_gpu_color_to_float (color, alt, opacity, instance->color);
|
||||
instance->shadow_offset[0] = shadow_offset->x;
|
||||
instance->shadow_offset[1] = shadow_offset->y;
|
||||
instance->shadow_spread = spread;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "gskgputypesprivate.h"
|
||||
#include "gsktypes.h"
|
||||
#include "gdkcolorprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
@ -9,15 +10,16 @@ G_BEGIN_DECLS
|
||||
|
||||
void gsk_gpu_box_shadow_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
GdkColorState *ccs,
|
||||
float opacity,
|
||||
const graphene_point_t *offset,
|
||||
gboolean inset,
|
||||
const graphene_rect_t *bounds,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *shadow_offset,
|
||||
float spread,
|
||||
float blur_radius,
|
||||
const graphene_point_t *offset,
|
||||
const float color[4]);
|
||||
const GdkColor *color);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -2303,9 +2303,14 @@ gsk_gpu_node_processor_add_inset_shadow_node (GskGpuNodeProcessor *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
gdk_color_init_from_rgba (&color, rgba);
|
||||
gsk_gpu_box_shadow_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_node_processor_color_states_for_rgba (self),
|
||||
self->ccs,
|
||||
self->opacity,
|
||||
&self->offset,
|
||||
TRUE,
|
||||
&node->bounds,
|
||||
gsk_inset_shadow_node_get_outline (node),
|
||||
@ -2313,8 +2318,8 @@ gsk_gpu_node_processor_add_inset_shadow_node (GskGpuNodeProcessor *self,
|
||||
gsk_inset_shadow_node_get_dy (node)),
|
||||
spread,
|
||||
blur_radius,
|
||||
&self->offset,
|
||||
GSK_RGBA_TO_VEC4_ALPHA (rgba, self->opacity));
|
||||
&color);
|
||||
gdk_color_finish (&color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2357,17 +2362,22 @@ gsk_gpu_node_processor_add_outset_shadow_node (GskGpuNodeProcessor *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
gdk_color_init_from_rgba (&color, rgba);
|
||||
gsk_gpu_box_shadow_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_node_processor_color_states_for_rgba (self),
|
||||
self->ccs,
|
||||
self->opacity,
|
||||
&self->offset,
|
||||
FALSE,
|
||||
&node->bounds,
|
||||
gsk_outset_shadow_node_get_outline (node),
|
||||
&GRAPHENE_POINT_INIT (dx, dy),
|
||||
spread,
|
||||
blur_radius,
|
||||
&self->offset,
|
||||
GSK_RGBA_TO_VEC4_ALPHA (rgba, self->opacity));
|
||||
&color);
|
||||
gdk_color_finish (&color);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user