diff --git a/examples/output-layout.c b/examples/output-layout.c index 0c85ba7f6..91ab80f4d 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -102,7 +102,7 @@ static void handle_output_frame(struct output_state *output, wlr_output_make_current(wlr_output, NULL); wlr_renderer_begin(sample->renderer, wlr_output); - wlr_renderer_clear(sample->renderer, 0.25f, 0.25f, 0.25f, 1); + wlr_renderer_clear(sample->renderer, &(float[]){0.25f, 0.25f, 0.25f, 1}); animate_cat(sample, output->output); diff --git a/examples/rotation.c b/examples/rotation.c index 4f7b1567d..e390daafe 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -44,7 +44,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts wlr_output_make_current(wlr_output, NULL); wlr_renderer_begin(sample->renderer, wlr_output); - wlr_renderer_clear(sample->renderer, 0.25f, 0.25f, 0.25f, 1); + wlr_renderer_clear(sample->renderer, &(float[]){0.25f, 0.25f, 0.25f, 1}); float matrix[16]; for (int y = -128 + (int)odata->y_offs; y < height; y += 128) { diff --git a/examples/tablet.c b/examples/tablet.c index f12ecbc46..ca76ec5ad 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -44,7 +44,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts wlr_output_make_current(wlr_output, NULL); wlr_renderer_begin(sample->renderer, wlr_output); - wlr_renderer_clear(sample->renderer, 0.25f, 0.25f, 0.25f, 1); + wlr_renderer_clear(sample->renderer, &(float[]){0.25f, 0.25f, 0.25f, 1}); float matrix[16], view[16]; float distance = 0.8f * (1 - sample->distance); diff --git a/examples/touch.c b/examples/touch.c index 2ef2712fc..3cf00e9ce 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -43,7 +43,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts wlr_output_make_current(wlr_output, NULL); wlr_renderer_begin(sample->renderer, wlr_output); - wlr_renderer_clear(sample->renderer, 0.25f, 0.25f, 0.25f, 1); + wlr_renderer_clear(sample->renderer, &(float[]){0.25f, 0.25f, 0.25f, 1}); float matrix[16]; struct touch_point *p; diff --git a/include/wlr/render.h b/include/wlr/render.h index c277ab179..ccc66d36b 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -13,8 +13,7 @@ struct wlr_renderer; void wlr_renderer_begin(struct wlr_renderer *r, struct wlr_output *output); void wlr_renderer_end(struct wlr_renderer *r); -void wlr_renderer_clear(struct wlr_renderer *r, float red, float green, - float blue, float alpha); +void wlr_renderer_clear(struct wlr_renderer *r, const float (*color)[4]); /** * Defines a scissor box. Only pixels that lie within the scissor box can be * modified by drawing functions. Providing a NULL `box` disables the scissor diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 2531f33c4..b8e998980 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -18,8 +18,7 @@ struct wlr_renderer { struct wlr_renderer_impl { void (*begin)(struct wlr_renderer *renderer, struct wlr_output *output); void (*end)(struct wlr_renderer *renderer); - void (*clear)(struct wlr_renderer *renderer, float red, float green, - float blue, float alpha); + void (*clear)(struct wlr_renderer *renderer, const float (*color)[4]); void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box); struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer); bool (*render_with_matrix)(struct wlr_renderer *renderer, diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index bdb62ff37..f57e9daea 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -121,9 +121,9 @@ static void wlr_gles2_end(struct wlr_renderer *wlr_renderer) { // no-op } -static void wlr_gles2_clear(struct wlr_renderer *wlr_renderer, float red, - float green, float blue, float alpha) { - glClearColor(red, green, blue, alpha); +static void wlr_gles2_clear(struct wlr_renderer *wlr_renderer, + const float (*color)[4]) { + glClearColor((*color)[0], (*color)[1], (*color)[2], (*color)[3]); glClear(GL_COLOR_BUFFER_BIT); } diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index b60a3f733..c8f06a649 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -23,9 +23,8 @@ void wlr_renderer_end(struct wlr_renderer *r) { r->impl->end(r); } -void wlr_renderer_clear(struct wlr_renderer *r, float red, float green, - float blue, float alpha) { - r->impl->clear(r, red, green, blue, alpha); +void wlr_renderer_clear(struct wlr_renderer *r, const float (*color)[4]) { + r->impl->clear(r, color); } void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box) { diff --git a/rootston/output.c b/rootston/output.c index 96e466a7c..7c520d868 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -361,7 +361,7 @@ static void render_output(struct roots_output *output) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - float clear_color[] = {0.25f, 0.25f, 0.25f}; + float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; // Check if we can delegate the fullscreen surface to the output if (output->fullscreen_view != NULL) { @@ -438,8 +438,7 @@ static void render_output(struct roots_output *output) { pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects); for (int i = 0; i < nrects; ++i) { scissor_output(output, &rects[i]); - wlr_renderer_clear(renderer, clear_color[0], clear_color[1], - clear_color[2], 1); + wlr_renderer_clear(renderer, &clear_color); } // If a view is fullscreen on this output, render it