On 2002.01.14 14:45 Shane Shields wrote:
hi all
this is just a little patch to fix the UPDOWN_GetArrowRect function where the midpoint is calculated by adding 1 to odd numbers. before it just added 1 to every number now it tests for odd numbers before adding.
Shane
Thanks Dan for the tips
Changelog:
Shane Shields locutus@all.at updown.c UPDOWN_GetArrowRect function added odd number checking
--- ./dlls/comctl32/updown.c.orig Mon Jan 14 20:35:07 2002 +++ ./dlls/comctl32/updown.c Sun Jan 13 17:28:18 2002 @@ -1,4 +1,4 @@ -/* +/*
- Updown control
- Copyright 1997 Dimitrie O. Paun
@@ -176,14 +176,16 @@ * round the uneven numbers by adding 1. */ if (dwStyle & UDS_HORZ) {
- len = rect->right - rect->left + 1; /* compute the width */
- len = rect->right - rect->left; /* compute the width */
- if (len % 2 != 0 ) len ++; /* if not an even number then add 1 */ if (incr)
rect->left = rect->left + len/2;
else rect->right = rect->left + len/2; } else {rect->left = rect->left + len/2;
- len = rect->bottom - rect->top + 1; /* compute the height */
- len = rect->bottom - rect->top; /* compute the height */
- if (len % 2 != 0 ) len ++; /* if not an even number then add 1 */ if (incr) rect->bottom = rect->top + len/2; else
The remainder of any even number divided by two is 0, the remainder of any odd number divided by two is 1.
Knowing this doesn't:
len+=(len%2);
make more sense. Leave the comment as is for clarity if you wish.
-Dave