[client] egl: fixed incorrect drawing of masked color cursors

This commit is contained in:
Geoffrey McRae 2022-01-24 06:56:32 +11:00
parent 1082875b8e
commit 96fa8891c8

View File

@ -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);