mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] EGL: implement damage-aware RGB24 copy
This commit is contained in:
parent
ea5b6b4026
commit
d02e3730b2
@ -78,6 +78,11 @@ 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);
|
||||||
@ -105,12 +110,23 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//FIXME! This is broken for BGR24
|
|
||||||
memcpy(damage->rects + damage->count, update->rects,
|
memcpy(damage->rects + damage->count, update->rects,
|
||||||
update->rectCount * sizeof(FrameDamageRect));
|
update->rectCount * sizeof(FrameDamageRect));
|
||||||
damage->count += update->rectCount;
|
damage->count += update->rectCount;
|
||||||
|
|
||||||
|
FrameDamageRect scaledDamageRects[damage->count];
|
||||||
|
for (int i = 0; i < damage->count; i++)
|
||||||
|
{
|
||||||
|
FrameDamageRect rect = damage->rects[i];
|
||||||
|
int originalX = rect.x;
|
||||||
|
int scaledX = scaleForBGR(originalX);
|
||||||
|
rect.x = scaledX;
|
||||||
|
rect.width = scaleForBGR(originalX + rect.width) - scaledX;
|
||||||
|
scaledDamageRects[i] = rect;
|
||||||
|
}
|
||||||
|
|
||||||
rectsFramebufferToBuffer(
|
rectsFramebufferToBuffer(
|
||||||
damage->rects,
|
scaledDamageRects,
|
||||||
damage->count,
|
damage->count,
|
||||||
texture->format.bpp,
|
texture->format.bpp,
|
||||||
parent->buf[parent->bufIndex].map,
|
parent->buf[parent->bufIndex].map,
|
||||||
|
Loading…
Reference in New Issue
Block a user