* 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:
parent
42b3a11f19
commit
158001f57d
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user