diff options
author | emersion <contact@emersion.fr> | 2018-04-12 19:38:33 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-12 19:38:33 -0400 |
commit | 1b802d92511dad4edcb6d1a0f3506a7646fe714b (patch) | |
tree | 95aa4f16e126454b41f73187fd264f569e559c39 /render | |
parent | 8f4039d799bc76612d2e440216cb9cb5242e2382 (diff) |
Make wlr_renderer_scissor take normal coords instead of upside-down ones
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/renderer.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 297ac886..97401010 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -31,11 +31,14 @@ static struct wlr_gles2_renderer *gles2_get_renderer_in_context( static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width, uint32_t height) { - gles2_get_renderer_in_context(wlr_renderer); + struct wlr_gles2_renderer *renderer = + gles2_get_renderer_in_context(wlr_renderer); GLES2_DEBUG_PUSH; glViewport(0, 0, width, height); + renderer->viewport_width = width; + renderer->viewport_height = height; // enable transparency glEnable(GL_BLEND); @@ -64,11 +67,16 @@ static void gles2_clear(struct wlr_renderer *wlr_renderer, static void gles2_scissor(struct wlr_renderer *wlr_renderer, struct wlr_box *box) { - gles2_get_renderer_in_context(wlr_renderer); + struct wlr_gles2_renderer *renderer = + gles2_get_renderer_in_context(wlr_renderer); GLES2_DEBUG_PUSH; if (box != NULL) { - glScissor(box->x, box->y, box->width, box->height); + struct wlr_box gl_box; + wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180, + renderer->viewport_width, renderer->viewport_height, &gl_box); + + glScissor(gl_box.x, gl_box.y, gl_box.width, gl_box.height); glEnable(GL_SCISSOR_TEST); } else { glDisable(GL_SCISSOR_TEST); |