replaced usage of floor() and ceil() to convert from
BRect to clipping_rect with simple C casts. I think this is more adequate, since clipping_rects are used for pixel indices. This change fixes some graphics problems too, it appears that cursor coords are fractional on Haiku, even with a normal mouse. In Playground, this resulted in the hit points being rendered wrongly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16840 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -85,7 +85,8 @@ offset_rect(clipping_rect &rect, int32 x, int32 y)
|
|||||||
static inline BRect
|
static inline BRect
|
||||||
to_BRect(const clipping_rect &rect)
|
to_BRect(const clipping_rect &rect)
|
||||||
{
|
{
|
||||||
return BRect((float)rect.left, (float)rect.top, (float)rect.right, (float)rect.bottom);
|
return BRect((float)rect.left, (float)rect.top,
|
||||||
|
(float)rect.right, (float)rect.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,11 +95,20 @@ static inline clipping_rect
|
|||||||
to_clipping_rect(const BRect &rect)
|
to_clipping_rect(const BRect &rect)
|
||||||
{
|
{
|
||||||
clipping_rect clipRect;
|
clipping_rect clipRect;
|
||||||
|
|
||||||
clipRect.left = (int32)floor(rect.left);
|
// NOTE: test fractional coords BRects -> BRegion on R5
|
||||||
clipRect.top = (int32)floor(rect.top);
|
// and compare with this implementation...
|
||||||
clipRect.right = (int32)ceil(rect.right);
|
// clipRect.left = (int32)floorf(rect.left);
|
||||||
clipRect.bottom = (int32)ceil(rect.bottom);
|
// clipRect.top = (int32)floorf(rect.top);
|
||||||
|
// clipRect.right = (int32)ceilf(rect.right);
|
||||||
|
// clipRect.bottom = (int32)ceilf(rect.bottom);
|
||||||
|
|
||||||
|
// NOTE: clipping_rects are used as "pixel indices"
|
||||||
|
// therefor, it should be ok to convert them like this:
|
||||||
|
clipRect.left = (int32)rect.left;
|
||||||
|
clipRect.top = (int32)rect.top;
|
||||||
|
clipRect.right = (int32)rect.right;
|
||||||
|
clipRect.bottom = (int32)rect.bottom;
|
||||||
|
|
||||||
return clipRect;
|
return clipRect;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user