@@ -104,37 +104,38 @@ inline MCGRectangle MCRectangle32ToMCGRectangle(const MCRectangle32 &p_rect)
104104 return MCGRectangleMake (p_rect .x , p_rect .y , p_rect .width , p_rect .height );
105105}
106106
107+ inline MCRectangle32 MCRectangle32FromMCGIntegerRectangle (const MCGIntegerRectangle & p_rect )
108+ {
109+ return MCRectangle32Make (p_rect .origin .x , p_rect .origin .y , p_rect .size .width , p_rect .size .height );
110+ }
111+
112+ inline MCGIntegerRectangle MCRectangle32ToMCGIntegerRectangle (const MCRectangle32 & p_rect )
113+ {
114+ return MCGIntegerRectangleMake (p_rect .x , p_rect .y , p_rect .width , p_rect .height );
115+ }
116+
107117////////////////////////////////////////////////////////////////////////////////
108118
109- inline MCRectangle32 MCGRectangleGetInt32Bounds (MCGRectangle p_rect )
110- {
111- int32_t t_left , t_right , t_top , t_bottom ;
112- t_left = floor (p_rect .origin .x );
113- t_top = floor (p_rect .origin .y );
114- t_right = ceil (p_rect .origin .x + p_rect .size .width );
115- t_bottom = ceil (p_rect .origin .y + p_rect .size .height );
116-
117- int32_t t_width , t_height ;
118- t_width = t_right - t_left ;
119- t_height = t_bottom - t_top ;
120-
121- // [[ Bug 11349 ]] Out of bounds content displayed since getting integer
122- // bounds of an empty rect is not empty.
123- if (p_rect . size . width == 0.0f || p_rect . size . height == 0.0f )
124- {
125- t_width = 0 ;
126- t_height = 0 ;
127- }
128-
129- MCRectangle32 t_rect ;
130- t_rect = MCRectangle32Make (t_left , t_top , t_width , t_height );
131-
132- return t_rect ;
119+ inline MCGIntegerRectangle MCRectangleToMCGIntegerRectangle (const MCRectangle & p_rect )
120+ {
121+ return MCGIntegerRectangleMake (p_rect .x , p_rect .y , p_rect .width , p_rect .height );
122+ }
123+
124+ inline MCRectangle MCRectangleFromMCGIntegerRectangle (const MCGIntegerRectangle & p_rect )
125+ {
126+ return MCRectangleMake (p_rect .origin .x , p_rect .origin .y , p_rect .size .width , p_rect .size .height );
127+ }
128+
129+ ////////////////////////////////////////////////////////////////////////////////
130+
131+ inline MCRectangle32 MCGRectangleGetInt32Bounds (const MCGRectangle & p_rect )
132+ {
133+ return MCRectangle32FromMCGIntegerRectangle (MCGRectangleGetBounds (p_rect ));
133134}
134135
135136inline MCRectangle MCGRectangleGetIntegerBounds (MCGRectangle p_rect )
136137{
137- return MCRectangle32ToMCRectangle ( MCGRectangleGetInt32Bounds (p_rect ));
138+ return MCRectangleFromMCGIntegerRectangle ( MCGRectangleGetBounds (p_rect ));
138139}
139140
140141inline MCRectangle MCGRectangleGetIntegerInterior (MCGRectangle p_rect )
@@ -186,18 +187,6 @@ inline MCRectangle MCGRectangleGetIntegerCeilingRect(const MCGRectangle &p_rect)
186187
187188////////////////////////////////////////////////////////////////////////////////
188189
189- inline MCGIntegerRectangle MCRectangleToMCGIntegerRectangle (const MCRectangle & p_rect )
190- {
191- return MCGIntegerRectangleMake (p_rect .x , p_rect .y , p_rect .width , p_rect .height );
192- }
193-
194- inline MCRectangle MCRectangleFromMCGIntegerRectangle (const MCGIntegerRectangle & p_rect )
195- {
196- return MCRectangleMake (p_rect .origin .x , p_rect .origin .y , p_rect .size .width , p_rect .size .height );
197- }
198-
199- ////////////////////////////////////////////////////////////////////////////////
200-
201190static inline MCPoint MCPointMake (int16_t x , int16_t y )
202191{
203192 MCPoint t_point ;
@@ -291,19 +280,19 @@ inline MCPoint MCPointTransform(const MCPoint &p_point, const MCGAffineTransform
291280
292281inline MCGFloat MCGAffineTransformGetEffectiveScale (const MCGAffineTransform & p_transform )
293282{
294- return MCMax (MCAbs (p_transform .a ), MCAbs (p_transform .d ));
283+ return MCMax (MCAbs (p_transform .a ) + MCAbs ( p_transform . c ) , MCAbs (p_transform .d ) + MCAbs ( p_transform . b ));
295284}
296285
297286////////////////////////////////////////////////////////////////////////////////
298287
299288inline MCGPoint MCGRectangleGetCenter (const MCGRectangle & p_rect )
300289{
301- return MCGPointMake (p_rect .origin .x + p_rect .size .width / 2.0 , p_rect .origin .y + p_rect .size .height / 2.0 );
290+ return MCGPointMake (p_rect .origin .x + p_rect .size .width / 2.0f , p_rect .origin .y + p_rect .size .height / 2.0f );
302291}
303292
304293inline MCGRectangle MCGRectangleCenterOnPoint (const MCGRectangle & p_rect , const MCGPoint & p_point )
305294{
306- return MCGRectangleMake (p_point .x - p_rect .size .width / 2.0 , p_point .y - p_rect .size .height / 2.0 , p_rect .size .width , p_rect .size .height );
295+ return MCGRectangleMake (p_point .x - p_rect .size .width / 2.0f , p_point .y - p_rect .size .height / 2.0f , p_rect .size .width , p_rect .size .height );
307296}
308297
309298inline MCGRectangle MCGRectangleCenterOnRect (const MCGRectangle & p_rect_a , const MCGRectangle & p_rect_b )
0 commit comments