From e30e5da75a9c90b6be48deae0d3e946ee65ad3a4 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 27 Jan 2020 16:16:43 +1100 Subject: [PATCH] [c-host] nvfbc: correct frame change check logic --- c-host/platform/Windows/capture/NVFBC/src/nvfbc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c index 0e917e02..886434be 100644 --- a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -258,9 +258,11 @@ static CaptureResult nvfbc_capture() return result; bool changed = false; - for(unsigned int y = 0; y < this->height / 128; ++y) - for(unsigned int x = 0; x < this->width / 128; ++x) - if (this->diffMap[x*y]) + const unsigned int h = (this->height + 127) / 128; + const unsigned int w = (this->width + 127) / 128; + for(unsigned int y = 0; y < h; ++y) + for(unsigned int x = 0; x < w; ++x) + if (this->diffMap[(y*w)+x]) { changed = true; break;