gl-renderer: Support solid-colour weston_buffers

Same as surface_set_color.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 43715ff0c0
commit 465f4a250c
  1. 44
      libweston/renderer-gl/gl-renderer.c

@ -2963,6 +2963,23 @@ out:
return ret;
}
static void
gl_renderer_surface_set_color(struct weston_surface *surface,
float red, float green, float blue, float alpha)
{
struct gl_surface_state *gs = get_surface_state(surface);
gs->color[0] = red;
gs->color[1] = green;
gs->color[2] = blue;
gs->color[3] = alpha;
gs->buffer_type = BUFFER_TYPE_SOLID;
gs->pitch = 1;
gs->height = 1;
gs->shader_variant = SHADER_VARIANT_SOLID;
}
static void
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
{
@ -3009,6 +3026,16 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
}
gl_renderer_attach_egl(es, buffer, format);
return;
case WESTON_BUFFER_SOLID:
gl_renderer_surface_set_color(es,
buffer->solid.r,
buffer->solid.g,
buffer->solid.b,
buffer->solid.a);
weston_buffer_reference(&gs->buffer_ref, NULL,
BUFFER_WILL_NOT_BE_ACCESSED);
weston_buffer_release_reference(&gs->buffer_release_ref, NULL);
return;
default:
break;
}
@ -3028,23 +3055,6 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
"disconnecting due to unhandled buffer type");
}
static void
gl_renderer_surface_set_color(struct weston_surface *surface,
float red, float green, float blue, float alpha)
{
struct gl_surface_state *gs = get_surface_state(surface);
gs->color[0] = red;
gs->color[1] = green;
gs->color[2] = blue;
gs->color[3] = alpha;
gs->buffer_type = BUFFER_TYPE_SOLID;
gs->pitch = 1;
gs->height = 1;
gs->shader_variant = SHADER_VARIANT_SOLID;
}
static void
gl_renderer_surface_get_content_size(struct weston_surface *surface,
int *width, int *height)

Loading…
Cancel
Save