From 2db26ae37e3dc5fa64c553079c50588b7e423f33 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 24 Sep 2018 20:11:42 +1000 Subject: [PATCH] [egl] fix incorrect mouse size and position scaling --- client/renderers/egl.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/client/renderers/egl.c b/client/renderers/egl.c index de8cd063..1006418e 100644 --- a/client/renderers/egl.c +++ b/client/renderers/egl.c @@ -83,7 +83,6 @@ struct Inst size_t frameSize; const uint8_t * data; bool update; - int screenW, screenH; bool mouseVisible; float mouseX, mouseY, mouseW, mouseH; @@ -165,15 +164,12 @@ void egl_on_resize(void * opaque, const int width, const int height, const LG_Re { struct Inst * this = (struct Inst *)opaque; - this->screenW = width; - this->screenH = height; - glViewport(0, 0, width, height); - this->mouseScaleX = 2.0f / width ; - this->mouseScaleY = 2.0f / height; - this->mouseW = this->mouseWidth * (1.0f / this->screenW); - this->mouseH = this->mouseHeight * (1.0f / this->screenH); + this->mouseScaleX = 2.0f / this->format.width; + this->mouseScaleY = 2.0f / this->format.height; + this->mouseW = this->mouseWidth * (1.0f / this->format.width ); + this->mouseH = this->mouseHeight * (1.0f / this->format.height); } bool egl_on_mouse_shape(void * opaque, const LG_RendererCursor cursor, const int width, const int height, const int pitch, const uint8_t * data) @@ -186,8 +182,8 @@ bool egl_on_mouse_shape(void * opaque, const LG_RendererCursor cursor, const int this->mouseHeight = height; this->mousePitch = pitch; - this->mouseW = this->mouseWidth * (1.0f / this->screenW); - this->mouseH = this->mouseHeight * (1.0f / this->screenH); + this->mouseW = this->mouseWidth * (1.0f / this->format.width ); + this->mouseH = this->mouseHeight * (1.0f / this->format.height); const size_t size = height * pitch; if (size > this->mouseDataSize)