From 63ecb59681340ce6b44cf26abc408cfc2ee65528 Mon Sep 17 00:00:00 2001 From: Clive Stevens Date: Wed, 20 May 2015 12:26:58 +0100 Subject: [PATCH] Fix rounding error in progressive codec The grid is composed of 64x64 blocks and should not be smaller than the surface. If width or height were not a multiple of 64 the previous rounding resulted in a grid smaller than the surface. --- libfreerdp/codec/progressive.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfreerdp/codec/progressive.c b/libfreerdp/codec/progressive.c index 770789a03..36fc4158f 100644 --- a/libfreerdp/codec/progressive.c +++ b/libfreerdp/codec/progressive.c @@ -262,8 +262,8 @@ PROGRESSIVE_SURFACE_CONTEXT* progressive_surface_context_new(UINT16 surfaceId, U surface->id = surfaceId; surface->width = width; surface->height = height; - surface->gridWidth = (width + (width % 64)) / 64; - surface->gridHeight = (height + (height % 64)) / 64; + surface->gridWidth = (width + (64 - width % 64)) / 64; + surface->gridHeight = (height + (64 - height % 64)) / 64; surface->gridSize = surface->gridWidth * surface->gridHeight; surface->tiles = (RFX_PROGRESSIVE_TILE*) calloc(surface->gridSize, sizeof(RFX_PROGRESSIVE_TILE));