From 4a75cc3bcf0c749bb50e27b59abff64f1e24700c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 8 Jun 2021 15:14:54 +1000 Subject: [PATCH] [common] framebuffer: simplify the `remaining` calculation The pitches match so there is no need for the added complexity of this calculation. --- common/src/framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/framebuffer.c b/common/src/framebuffer.c index 4fb5a547..e61d3e73 100644 --- a/common/src/framebuffer.c +++ b/common/src/framebuffer.c @@ -76,7 +76,7 @@ bool framebuffer_read(const FrameBuffer * frame, void * restrict dst, // copy in large 1MB chunks if the pitches match if (dstpitch == pitch) { - size_t remaining = (height - 1) * pitch + dstpitch; + size_t remaining = height * pitch; while(remaining) { const size_t copy = remaining < FB_CHUNK_SIZE ? remaining : FB_CHUNK_SIZE;