mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-05-18 04:21:29 +00:00
[host] nvfbc: populate damage rectangles
This commit is contained in:
parent
d7f9afb3ba
commit
6b16bb3ea1
@ -28,6 +28,7 @@
|
|||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "common/dpi.h"
|
#include "common/dpi.h"
|
||||||
|
#include "common/KVMFR.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -330,6 +331,32 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
|
|||||||
frame->stride = this->grabStride;
|
frame->stride = this->grabStride;
|
||||||
frame->rotation = CAPTURE_ROT_0;
|
frame->rotation = CAPTURE_ROT_0;
|
||||||
|
|
||||||
|
const unsigned int h = (this->height + 127) / 128;
|
||||||
|
const unsigned int w = (this->width + 127) / 128;
|
||||||
|
|
||||||
|
// TODO: use some algorithm to merge large regions
|
||||||
|
int rectId = 0;
|
||||||
|
for (unsigned int y = 0; y < h; ++y)
|
||||||
|
for (unsigned int x = 0; x < w; ++x)
|
||||||
|
if (this->diffMap[(y*w)+x])
|
||||||
|
{
|
||||||
|
if (rectId >= KVMFR_MAX_DAMAGE_RECTS)
|
||||||
|
{
|
||||||
|
rectId = 0;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
frame->damageRects[rectId++] = (FrameDamageRect) {
|
||||||
|
.x = x * 128,
|
||||||
|
.y = y * 128,
|
||||||
|
.width = 128,
|
||||||
|
.height = 128,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
frame->damageRectsCount = rectId;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//NvFBC never sets bIsHDR so instead we check for any data in the alpha channel
|
//NvFBC never sets bIsHDR so instead we check for any data in the alpha channel
|
||||||
//If there is data, it's HDR. This is clearly suboptimal
|
//If there is data, it's HDR. This is clearly suboptimal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user