Fixed the scrollbar position overflows using MulDiv.

This commit is contained in:
Phillip Ezolt 2002-02-19 18:36:55 +00:00 committed by Alexandre Julliard
parent 13f1fb23fe
commit 76198ce262
1 changed files with 3 additions and 3 deletions

View File

@ -257,7 +257,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
if (info->Page) if (info->Page)
{ {
*thumbSize = pixels * info->Page / (info->MaxVal-info->MinVal+1); *thumbSize = MulDiv(pixels,info->Page,(info->MaxVal-info->MinVal+1));
if (*thumbSize < SCROLL_MIN_THUMB) *thumbSize = SCROLL_MIN_THUMB; if (*thumbSize < SCROLL_MIN_THUMB) *thumbSize = SCROLL_MIN_THUMB;
} }
else *thumbSize = GetSystemMetrics(SM_CXVSCROLL); else *thumbSize = GetSystemMetrics(SM_CXVSCROLL);
@ -275,7 +275,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
*thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP; *thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
else else
*thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP *thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP
+ pixels * (info->CurVal-info->MinVal) / (max - info->MinVal); + MulDiv(pixels, (info->CurVal-info->MinVal),(max - info->MinVal));
} }
} }
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
@ -300,7 +300,7 @@ static UINT SCROLL_GetThumbVal( SCROLLBAR_INFO *infoPtr, RECT *rect,
if (infoPtr->Page) if (infoPtr->Page)
{ {
thumbSize = pixels * infoPtr->Page/(infoPtr->MaxVal-infoPtr->MinVal+1); thumbSize = MulDiv(pixels,infoPtr->Page,(infoPtr->MaxVal-infoPtr->MinVal+1));
if (thumbSize < SCROLL_MIN_THUMB) thumbSize = SCROLL_MIN_THUMB; if (thumbSize < SCROLL_MIN_THUMB) thumbSize = SCROLL_MIN_THUMB;
} }
else thumbSize = GetSystemMetrics(SM_CXVSCROLL); else thumbSize = GetSystemMetrics(SM_CXVSCROLL);