mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] egl: only scale damage rects if it's packed BGR
This commit is contained in:
parent
a455078e0f
commit
4aba15f31c
@ -78,11 +78,6 @@ bool egl_texFBSetup(EGL_Texture * texture, const EGL_TexSetup * setup)
|
|||||||
return egl_texBufferStreamSetup(texture, setup);
|
return egl_texBufferStreamSetup(texture, setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scaleForBGR(int x)
|
|
||||||
{
|
|
||||||
return x * 3 / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||||
{
|
{
|
||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
@ -114,14 +109,16 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
|||||||
update->rectCount * sizeof(FrameDamageRect));
|
update->rectCount * sizeof(FrameDamageRect));
|
||||||
damage->count += update->rectCount;
|
damage->count += update->rectCount;
|
||||||
|
|
||||||
|
if (texture->format.pixFmt == EGL_PF_BGR)
|
||||||
|
{
|
||||||
FrameDamageRect scaledDamageRects[damage->count];
|
FrameDamageRect scaledDamageRects[damage->count];
|
||||||
for (int i = 0; i < damage->count; i++)
|
for (int i = 0; i < damage->count; i++)
|
||||||
{
|
{
|
||||||
FrameDamageRect rect = damage->rects[i];
|
FrameDamageRect rect = damage->rects[i];
|
||||||
int originalX = rect.x;
|
int originalX = rect.x;
|
||||||
int scaledX = scaleForBGR(originalX);
|
int scaledX = originalX * 3 / 4;
|
||||||
rect.x = scaledX;
|
rect.x = scaledX;
|
||||||
rect.width = scaleForBGR(originalX + rect.width) - scaledX;
|
rect.width = (((originalX + rect.width) * 3 + 3) / 4) - scaledX;
|
||||||
scaledDamageRects[i] = rect;
|
scaledDamageRects[i] = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +133,20 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
|||||||
texture->format.pitch
|
texture->format.pitch
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rectsFramebufferToBuffer(
|
||||||
|
damage->rects,
|
||||||
|
damage->count,
|
||||||
|
texture->format.bpp,
|
||||||
|
parent->buf[parent->bufIndex].map,
|
||||||
|
texture->format.pitch,
|
||||||
|
texture->format.height,
|
||||||
|
update->frame,
|
||||||
|
texture->format.pitch
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parent->buf[parent->bufIndex].updated = true;
|
parent->buf[parent->bufIndex].updated = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user