mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:03:40 +00:00
[client] egl: make damage overlay support rendering rotated rectangles
This commit is contained in:
parent
2ef80a5d34
commit
d0722349e6
@ -48,6 +48,7 @@ struct EGL_Damage
|
|||||||
int width , height;
|
int width , height;
|
||||||
float translateX, translateY;
|
float translateX, translateY;
|
||||||
float scaleX , scaleY;
|
float scaleX , scaleY;
|
||||||
|
bool rotate;
|
||||||
|
|
||||||
// uniforms
|
// uniforms
|
||||||
GLint uTransform;
|
GLint uTransform;
|
||||||
@ -133,10 +134,12 @@ void egl_damage_free(EGL_Damage ** damage)
|
|||||||
|
|
||||||
static void update_matrix(EGL_Damage * damage)
|
static void update_matrix(EGL_Damage * damage)
|
||||||
{
|
{
|
||||||
damage->transform[0] = 2.0f * damage->scaleX / damage->width;
|
int width = damage->rotate ? damage->height : damage->width;
|
||||||
|
int height = damage->rotate ? damage->width : damage->height;
|
||||||
|
damage->transform[0] = 2.0f * damage->scaleX / width;
|
||||||
damage->transform[1] = 0.0f;
|
damage->transform[1] = 0.0f;
|
||||||
damage->transform[2] = 0.0f;
|
damage->transform[2] = 0.0f;
|
||||||
damage->transform[3] = -2.0f * damage->scaleY / damage->height;
|
damage->transform[3] = -2.0f * damage->scaleY / height;
|
||||||
damage->transform[4] = damage->translateX - damage->scaleX;
|
damage->transform[4] = damage->translateX - damage->scaleX;
|
||||||
damage->transform[5] = damage->translateY + damage->scaleY;
|
damage->transform[5] = damage->translateY + damage->scaleY;
|
||||||
}
|
}
|
||||||
@ -170,11 +173,16 @@ inline static void rectToVertices(GLfloat * vertex, const FrameDamageRect * rect
|
|||||||
vertex[7] = rect->y + rect->height;
|
vertex[7] = rect->y + rect->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool egl_damage_render(EGL_Damage * damage, const struct DesktopDamage * data)
|
bool egl_damage_render(EGL_Damage * damage, bool rotate, const struct DesktopDamage * data)
|
||||||
{
|
{
|
||||||
if (!damage->show || (!data && damage->count == -1))
|
if (!damage->show || (!data && damage->count == -1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (rotate != damage->rotate)
|
||||||
|
{
|
||||||
|
damage->rotate = rotate;
|
||||||
|
update_matrix(damage);
|
||||||
|
}
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -37,4 +37,4 @@ void egl_damage_free(EGL_Damage ** damage);
|
|||||||
void egl_damage_setup(EGL_Damage * damage, int width, int height);
|
void egl_damage_setup(EGL_Damage * damage, int width, int height);
|
||||||
void egl_damage_resize(EGL_Damage * damage, float translateX, float translateY,
|
void egl_damage_resize(EGL_Damage * damage, float translateX, float translateY,
|
||||||
float scaleX, float scaleY);
|
float scaleX, float scaleY);
|
||||||
bool egl_damage_render(EGL_Damage * damage, const struct DesktopDamage * data);
|
bool egl_damage_render(EGL_Damage * damage, bool rotate, const struct DesktopDamage * data);
|
||||||
|
Loading…
Reference in New Issue
Block a user