2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ScalerDiv()
9 #include "graphics_intern.h"
11 /*****************************************************************************
14 #include <proto/graphics.h>
16 AROS_LH3(UWORD
, ScalerDiv
,
19 AROS_LHA(UWORD
, factor
, D0
),
20 AROS_LHA(UWORD
, numerator
, D1
),
21 AROS_LHA(UWORD
, denominator
, D2
),
24 struct GfxBase
*, GfxBase
, 114, Graphics
)
27 Use this to precalculate the width/height of the destination
28 bitmap. As factor give the width/height of the original bitmap
29 that is to be scaled via ScaleBitMap(), as numerator give
30 the value you will write into bsa_XSrcFactor/bsa_YSrcFactor
31 and as denominator the value of bsa_XDestFactor/bsa_YDestFactor.
34 factor - a number in the range of 0..16383
35 numerator - a number in the range of 1..16383
36 denominator - a number in the range of 1..16383
53 *****************************************************************************/
58 if (0 == factor
|| 0 == numerator
|| 0 == denominator
)
61 res
= (ULONG
)((ULONG
)factor
* (ULONG
)numerator
) / denominator
;
66 if (((factor
* numerator
) % denominator
) >= ((denominator
+ 1) >> 1))