pixman-renderer: Support solid-colour weston_buffers
Just implemented via the same mechanism as surface_set_color. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
465f4a250c
commit
d82d74e713
|
@ -620,6 +620,26 @@ buffer_state_handle_buffer_destroy(struct wl_listener *listener, void *data)
|
||||||
ps->buffer_destroy_listener.notify = NULL;
|
ps->buffer_destroy_listener.notify = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pixman_renderer_surface_set_color(struct weston_surface *es,
|
||||||
|
float red, float green, float blue, float alpha)
|
||||||
|
{
|
||||||
|
struct pixman_surface_state *ps = get_surface_state(es);
|
||||||
|
pixman_color_t color;
|
||||||
|
|
||||||
|
color.red = red * 0xffff;
|
||||||
|
color.green = green * 0xffff;
|
||||||
|
color.blue = blue * 0xffff;
|
||||||
|
color.alpha = alpha * 0xffff;
|
||||||
|
|
||||||
|
if (ps->image) {
|
||||||
|
pixman_image_unref(ps->image);
|
||||||
|
ps->image = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ps->image = pixman_image_create_solid_fill(&color);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||||
{
|
{
|
||||||
|
@ -646,6 +666,18 @@ pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (buffer->type == WESTON_BUFFER_SOLID) {
|
||||||
|
pixman_renderer_surface_set_color(es,
|
||||||
|
buffer->solid.r,
|
||||||
|
buffer->solid.g,
|
||||||
|
buffer->solid.b,
|
||||||
|
buffer->solid.a);
|
||||||
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
||||||
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
||||||
|
weston_buffer_release_reference(&ps->buffer_release_ref, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (buffer->type != WESTON_BUFFER_SHM) {
|
if (buffer->type != WESTON_BUFFER_SHM) {
|
||||||
weston_log("Pixman renderer supports only SHM buffers\n");
|
weston_log("Pixman renderer supports only SHM buffers\n");
|
||||||
weston_buffer_reference(&ps->buffer_ref, NULL,
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
||||||
|
@ -752,26 +784,6 @@ pixman_renderer_create_surface(struct weston_surface *surface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
pixman_renderer_surface_set_color(struct weston_surface *es,
|
|
||||||
float red, float green, float blue, float alpha)
|
|
||||||
{
|
|
||||||
struct pixman_surface_state *ps = get_surface_state(es);
|
|
||||||
pixman_color_t color;
|
|
||||||
|
|
||||||
color.red = red * 0xffff;
|
|
||||||
color.green = green * 0xffff;
|
|
||||||
color.blue = blue * 0xffff;
|
|
||||||
color.alpha = alpha * 0xffff;
|
|
||||||
|
|
||||||
if (ps->image) {
|
|
||||||
pixman_image_unref(ps->image);
|
|
||||||
ps->image = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ps->image = pixman_image_create_solid_fill(&color);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pixman_renderer_destroy(struct weston_compositor *ec)
|
pixman_renderer_destroy(struct weston_compositor *ec)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue