From 27f3af8221b44a65f099880cf31adadb379b7b2f Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Nov 2023 09:08:56 +1100 Subject: [PATCH] [host] nvfbc: cosmetics --- .../Windows/capture/NVFBC/src/nvfbc.c | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 3fe379c3..537d1a49 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -743,11 +743,19 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame, int frameIndex) this->diffMap[y * w + x2])) ++x2; - unsigned int width = (min(x2 << this->diffShift, this->grabWidth) - - (x << this->diffShift)) * this->bpp; - rectCopyUnaligned(frameData, this->frameBuffer, ystart, yend, - (x << this->diffShift) * this->bpp, this->shmStride * this->bpp, - this->grabStride * this->bpp, width); + unsigned int xstart = x << this->diffShift; + unsigned int xend = min(x2 << this->diffShift, this->grabWidth); + unsigned int width = xend - xstart; + + rectCopyUnaligned( + frameData, + this->frameBuffer, + ystart, + yend, + xstart * this->bpp, + this->shmStride * this->bpp, + this->grabStride * this->bpp, + width * this->bpp); x = x2; } @@ -759,9 +767,16 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame, int frameIndex) for (int y = 0; y < this->dataHeight; y += 64) { int yend = min(this->dataHeight, y + 128); - rectCopyUnaligned(frameData, this->frameBuffer, y, yend, 0, - this->shmStride * this->bpp, this->grabStride * this->bpp, - this->grabWidth * this->bpp); + rectCopyUnaligned( + frameData, + this->frameBuffer, + y, + yend, + 0, + this->shmStride * this->bpp, + this->grabStride * this->bpp, + this->grabWidth * this->bpp); + framebuffer_set_write_ptr(frame, yend * this->shmStride * this->bpp); } }