From 96fa8891c885785c08c1017330279ba8ecb72c17 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 24 Jan 2022 06:56:32 +1100 Subject: [PATCH] [client] egl: fixed incorrect drawing of masked color cursors --- client/renderers/EGL/cursor.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/client/renderers/EGL/cursor.c b/client/renderers/EGL/cursor.c index a9f75839..f4215801 100644 --- a/client/renderers/EGL/cursor.c +++ b/client/renderers/EGL/cursor.c @@ -260,7 +260,13 @@ struct CursorState egl_cursorRender(EGL_Cursor * cursor, switch(cursor->type) { case LG_CURSOR_MASKED_COLOR: - // fall through + for(int y = 0; y < cursor->height; ++y) + for(int x = 0; x < cursor->width; ++x) + { + uint8_t * mask = data + (cursor->stride * y) + x * 4 + 3; + *mask = (*mask == 0xFF) ? 0x00 : 0xFF; + } + // fall through case LG_CURSOR_COLOR: { @@ -377,6 +383,7 @@ struct CursorState egl_cursorRender(EGL_Cursor * cursor, break; } + case LG_CURSOR_MASKED_COLOR: case LG_CURSOR_COLOR: { egl_shaderUse(cursor->norm.shader); @@ -386,16 +393,6 @@ struct CursorState egl_cursorRender(EGL_Cursor * cursor, egl_modelRender(cursor->model); break; } - - case LG_CURSOR_MASKED_COLOR: - { - egl_shaderUse(cursor->mono.shader); - setCursorTexUniforms(cursor, &cursor->mono, false, pos.x, pos.y, - size.w, size.h, scale); - glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); - egl_modelRender(cursor->model); - break; - } } glDisable(GL_BLEND);