* fractional rects need to be aligned if not drawing in subpixel precise mode,

by now, I feel there is too much code involved in this... I guess I should
  really move this to stuff to ViewLayer::ConvertToScreenForDrawing()...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22223 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2007-09-12 08:18:09 +00:00
parent 42b3a11f19
commit 158001f57d
3 changed files with 20 additions and 4 deletions

View File

@ -792,7 +792,7 @@ DrawingEngine::FillRect(BRect r)
CRASH_IF_NOT_LOCKED
make_rect_valid(r);
r = fPainter->ClipRect(r);
r = fPainter->AlignAndClipRect(r);
if (r.IsValid()) {
bool cursorTouched = fGraphicsCard->HideSoftwareCursor(r);

View File

@ -561,9 +561,8 @@ Painter::StrokeRect(const BRect& r) const
{
CHECK_CLIPPING
// support invalid rects
BPoint a(min_c(r.left, r.right), min_c(r.top, r.bottom));
BPoint b(max_c(r.left, r.right), max_c(r.top, r.bottom));
BPoint a(r.left, r.top);
BPoint b(r.right, r.bottom);
_Transform(&a, false);
_Transform(&b, false);

View File

@ -192,6 +192,8 @@ class Painter {
BRect InvertRect( const BRect& r) const;
inline BRect ClipRect( BRect rect) const;
inline BRect AlignAndClipRect(BRect rect) const;
private:
void _Transform(BPoint* point,
@ -290,6 +292,21 @@ Painter::ClipRect(BRect rect) const
return _Clipped(rect);
}
inline BRect
Painter::AlignAndClipRect(BRect rect) const
{
rect.left = floorf(rect.left);
rect.top = floorf(rect.top);
if (fSubpixelPrecise) {
rect.right = ceilf(rect.right);
rect.bottom = ceilf(rect.bottom);
} else {
rect.right = floorf(rect.right);
rect.bottom = floorf(rect.bottom);
}
return _Clipped(rect);
}
#endif // PAINTER_H