From 10bea2819ba8f4ec4aee5cfe9daf5a6941540557 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 19 Sep 2018 16:27:56 +0200 Subject: [PATCH] Fix calculation of maximum lossless refresh area The update size is in bytes, but we are counting pixels. So make sure we convert things properly before comparing. --- common/rfb/EncodeManager.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 8f5427c8..d783d54b 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -476,6 +476,9 @@ Region EncodeManager::getLosslessRefresh(const Region& req, // We make a conservative guess at the compression ratio at 2:1 maxUpdateSize *= 2; + // We will measure pixels, not bytes (assume 32 bpp) + maxUpdateSize /= 4; + area = 0; pendingRefreshRegion.intersect(req).get_rects(&rects); while (!rects.empty()) { -- 2.39.5