mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] renderers: treat -1 as full damage and 0 as no overlay
This makes everything consistent.
This commit is contained in:
parent
4c60409aaf
commit
947eac52f6
@ -85,8 +85,8 @@ void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
|||||||
/**
|
/**
|
||||||
* render the overlay
|
* render the overlay
|
||||||
* returns:
|
* returns:
|
||||||
* -1 for no overlay
|
* -1 for full output damage
|
||||||
* 0 for full output damage
|
* 0 for no overlay
|
||||||
* >0 number of rects written into rects
|
* >0 number of rects written into rects
|
||||||
*/
|
*/
|
||||||
int app_renderOverlay(struct Rect * rects, int maxRects);
|
int app_renderOverlay(struct Rect * rects, int maxRects);
|
||||||
|
@ -1010,22 +1010,20 @@ bool egl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame)
|
|||||||
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + 12];
|
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + 12];
|
||||||
int damageIdx = app_renderOverlay(damage, 10);
|
int damageIdx = app_renderOverlay(damage, 10);
|
||||||
|
|
||||||
// if no overlay
|
switch (damageIdx)
|
||||||
if (damageIdx == -1)
|
|
||||||
{
|
{
|
||||||
|
case 0: // no overlay
|
||||||
|
break;
|
||||||
|
case -1: // full damage
|
||||||
|
hasOverlay = true;
|
||||||
damageIdx = 0;
|
damageIdx = 0;
|
||||||
}
|
// fallthrough
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||||
|
|
||||||
for (int i = 0; i < damageIdx; ++i)
|
for (int i = 0; i < damageIdx; ++i)
|
||||||
damage[i].y = this->height - damage[i].y - damage[i].h;
|
damage[i].y = this->height - damage[i].y - damage[i].h;
|
||||||
|
|
||||||
// if there were too many rects invalidate the entire window
|
|
||||||
if (damageIdx == 0)
|
|
||||||
hasOverlay = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasOverlay && !this->hadOverlay)
|
if (!hasOverlay && !this->hadOverlay)
|
||||||
|
@ -686,7 +686,7 @@ bool opengl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app_renderOverlay(NULL, 0) > -1)
|
if (app_renderOverlay(NULL, 0) != 0)
|
||||||
{
|
{
|
||||||
ImGui_ImplOpenGL2_NewFrame();
|
ImGui_ImplOpenGL2_NewFrame();
|
||||||
ImGui_ImplOpenGL2_RenderDrawData(igGetDrawData());
|
ImGui_ImplOpenGL2_RenderDrawData(igGetDrawData());
|
||||||
|
@ -662,7 +662,7 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
|
|||||||
const int written =
|
const int written =
|
||||||
overlay->ops->render(overlay->udata, false, rects, maxRects);
|
overlay->ops->render(overlay->udata, false, rects, maxRects);
|
||||||
|
|
||||||
if (!totalDamage)
|
if (totalDamage)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (written == -1)
|
if (written == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user