diff --git a/gsk/gpu/gskgpucolorizeop.c b/gsk/gpu/gskgpucolorizeop.c index eb5ebf9715..045e84495a 100644 --- a/gsk/gpu/gskgpucolorizeop.c +++ b/gsk/gpu/gskgpucolorizeop.c @@ -49,15 +49,13 @@ static const GskGpuShaderOpClass GSK_GPU_COLORIZE_OP_CLASS = { }; void -gsk_gpu_colorize_op (GskGpuFrame *frame, - GskGpuShaderClip clip, - GskGpuColorStates color_states, - GskGpuDescriptors *descriptors, - guint32 descriptor, - const graphene_rect_t *rect, - const graphene_point_t *offset, - const graphene_rect_t *tex_rect, - const float color[4]) +gsk_gpu_colorize_op (GskGpuFrame *frame, + GskGpuShaderClip clip, + GskGpuColorStates color_states, + GskGpuDescriptors *descriptors, + const graphene_point_t *offset, + const GskGpuShaderImage *image, + const float color[4]) { GskGpuColorizeInstance *instance; @@ -69,8 +67,8 @@ gsk_gpu_colorize_op (GskGpuFrame *frame, descriptors, &instance); - gsk_gpu_rect_to_float (rect, offset, instance->rect); - gsk_gpu_rect_to_float (tex_rect, offset, instance->tex_rect); - instance->tex_id = descriptor; + gsk_gpu_rect_to_float (image->coverage ? image->coverage : image->bounds, offset, instance->rect); + gsk_gpu_rect_to_float (image->bounds, offset, instance->tex_rect); + instance->tex_id = image->descriptor; gsk_gpu_color_to_float (color, instance->color); } diff --git a/gsk/gpu/gskgpucolorizeopprivate.h b/gsk/gpu/gskgpucolorizeopprivate.h index 3c75ff4b25..3fe39f4aa4 100644 --- a/gsk/gpu/gskgpucolorizeopprivate.h +++ b/gsk/gpu/gskgpucolorizeopprivate.h @@ -10,10 +10,8 @@ void gsk_gpu_colorize_op (GskGpuF GskGpuShaderClip clip, GskGpuColorStates color_states, GskGpuDescriptors *desc, - guint32 descriptor, - const graphene_rect_t *rect, const graphene_point_t *offset, - const graphene_rect_t *tex_rect, + const GskGpuShaderImage *image, const float color[4]); diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index 5ffe7df433..82ec2773e6 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -2502,10 +2502,14 @@ gsk_gpu_node_processor_add_shadow_node (GskGpuNodeProcessor *self, gsk_gpu_clip_get_shader_clip (&self->clip, &shadow_offset, &child->bounds), gsk_gpu_node_processor_color_states_for_rgba (self), desc, - descriptor, - &child->bounds, &shadow_offset, - &tex_rect, + &(GskGpuShaderImage) { + image, + GSK_GPU_SAMPLER_TRANSPARENT, + descriptor, + &child->bounds, + &tex_rect, + }, GSK_RGBA_TO_VEC4 (&shadow->color)); } else @@ -2736,10 +2740,14 @@ gsk_gpu_node_processor_add_mask_node (GskGpuNodeProcessor *self, gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds), gsk_gpu_node_processor_color_states_for_rgba (self), self->desc, - descriptor, - &node->bounds, &self->offset, - &mask_rect, + &(GskGpuShaderImage) { + mask_image, + GSK_GPU_SAMPLER_DEFAULT, + descriptor, + &node->bounds, + &mask_rect, + }, GSK_RGBA_TO_VEC4_ALPHA (rgba, self->opacity)); } else @@ -2892,10 +2900,14 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self, gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds), gsk_gpu_node_processor_color_states_for_rgba (self), self->desc, - descriptor, - &glyph_bounds, &glyph_origin, - &glyph_tex_rect, + &(GskGpuShaderImage) { + image, + GSK_GPU_SAMPLER_DEFAULT, + descriptor, + &glyph_bounds, + &glyph_tex_rect + }, GSK_RGBA_TO_VEC4 (&color)); offset.x += glyphs[i].geometry.width * inv_pango_scale; diff --git a/gsk/gpu/gskgpushaderopprivate.h b/gsk/gpu/gskgpushaderopprivate.h index 4c80d85b74..4bc7871793 100644 --- a/gsk/gpu/gskgpushaderopprivate.h +++ b/gsk/gpu/gskgpushaderopprivate.h @@ -5,8 +5,19 @@ #include "gskgputypesprivate.h" #include "gskgpucolorstatesprivate.h" +#include + G_BEGIN_DECLS +struct _GskGpuShaderImage +{ + GskGpuImage *image; /* image to draw */ + GskGpuSampler sampler; /* sampler to use for image */ + guint32 descriptor; /* FIXME: preallocated descriptor for image + sampler */ + const graphene_rect_t *coverage; /* the clip area for the image or NULL for unclipped */ + const graphene_rect_t *bounds; /* bounds for the image */ +}; + struct _GskGpuShaderOp { GskGpuOp parent_op; diff --git a/gsk/gpu/gskgputypesprivate.h b/gsk/gpu/gskgputypesprivate.h index 0279d159f6..a8fcb3e7f3 100644 --- a/gsk/gpu/gskgputypesprivate.h +++ b/gsk/gpu/gskgputypesprivate.h @@ -15,6 +15,7 @@ typedef struct _GskGpuFrame GskGpuFrame; typedef struct _GskGpuImage GskGpuImage; typedef struct _GskGpuOp GskGpuOp; typedef struct _GskGpuOpClass GskGpuOpClass; +typedef struct _GskGpuShaderImage GskGpuShaderImage; typedef struct _GskGpuShaderOp GskGpuShaderOp; typedef struct _GskGpuShaderOpClass GskGpuShaderOpClass; typedef struct _GskVulkanDescriptors GskVulkanDescriptors;