(Update) ScrollBar with MulDiv
Phillip Ezolt
ezolt at perf.zko.dec.com
Mon Feb 18 09:37:21 CST 2002
Hi All,
This patch fixes the scrollbar position over-flow using MulDiv instead
of Floats. (Per Alexandre's suggestion.)
See my previous patch for a full explanation.
I believe that there are still some overflow issues when MAX_RANGE is
used, but I am looking into that now.
--Phil
Compaq: High Performance Server Systems Quality & Performance Engineering
---------------------------------------------------------------------------
Phillip.Ezolt at compaq.com Performance Tools/Analysis
-------------- next part --------------
--- controls/scroll.c.orig Wed Feb 13 11:24:41 2002
+++ controls/scroll.c Mon Feb 18 10:28:05 2002
@@ -257,7 +257,7 @@
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;
}
else *thumbSize = GetSystemMetrics(SM_CXVSCROLL);
@@ -275,7 +275,7 @@
*thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
else
*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);
@@ -300,7 +300,7 @@
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;
}
else thumbSize = GetSystemMetrics(SM_CXVSCROLL);
More information about the wine-patches
mailing list