From 8ff3c7e623cc5b2ac02e64426218c0adec9d5936 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 15 Aug 2005 09:34:21 +0000 Subject: [PATCH] Better computations to have uniformly sized parts scaled in both directions. --- dlls/uxtheme/draw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c index 791b80a6737..20e4992ae9e 100644 --- a/dlls/uxtheme/draw.c +++ b/dlls/uxtheme/draw.c @@ -448,14 +448,14 @@ static HRESULT get_image_part_size (HTHEME hTheme, HDC hdc, int iPartId, GetThemeBool(hTheme, iPartId, iStateId, TMT_UNIFORMSIZING, &uniformsizing); if(uniformsizing) { /* Scale height and width equally */ - int widthDiff = abs(srcSize.x-dstSize.x); - int heightDiff = abs(srcSize.y-dstSize.x); - if(widthDiff > heightDiff) { - dstSize.y -= widthDiff-heightDiff; + if (dstSize.x*srcSize.y < dstSize.y*srcSize.x) + { + dstSize.y = MulDiv (srcSize.y, dstSize.x, srcSize.x); rcDst.bottom = rcDst.top + dstSize.y; } - else if(heightDiff > widthDiff) { - dstSize.x -= heightDiff-widthDiff; + else + { + dstSize.x = MulDiv (srcSize.x, dstSize.y, srcSize.y); rcDst.right = rcDst.left + dstSize.x; } }