(Update) ScrollBar with MulDiv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@compaq.com                         Performance Tools/Analysis

--- 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);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux