diff options
author | Guido Cella <guidocella91@gmail.com> | 2020-08-27 15:40:15 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-08-27 17:39:31 +0200 |
commit | 6949d0fd381dcb5df61d78b34b325473a113f279 (patch) | |
tree | 390193e2f1041ad4198922ee979ae289319902ed /render/wlr_renderer.c | |
parent | 2072d59da54ac772410271ad2219ca107a7fff48 (diff) |
render: Don't crash on 0 dimensions
Don't force compositors to check when an empty shape is being renderered.
References #2282. This was motivated by dwl crashing when setting window
borders to 0 (djpohly/dwl#51).
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r-- | render/wlr_renderer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 593d165f..8fa11cc9 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -99,6 +99,9 @@ bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r, void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box, const float color[static 4], const float projection[static 9]) { + if (box->width == 0 || box->height == 0) { + return; + } assert(box->width > 0 && box->height > 0); float matrix[9]; wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, @@ -115,6 +118,9 @@ void wlr_render_quad_with_matrix(struct wlr_renderer *r, void wlr_render_ellipse(struct wlr_renderer *r, const struct wlr_box *box, const float color[static 4], const float projection[static 9]) { + if (box->width == 0 || box->height == 0) { + return; + } assert(box->width > 0 && box->height > 0); float matrix[9]; wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, |