From 846cc588f2ea43ed5afa4651bde8e61ea6969e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 14 Sep 2006 18:03:39 +0000 Subject: [PATCH] * a fix for the bug where clicking a window decor button drew over the mouse cursor. The problem is actually something else: non-straight lines extend a little past the calculated rectangle git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18842 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/DrawingEngine.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/servers/app/drawing/DrawingEngine.cpp b/src/servers/app/drawing/DrawingEngine.cpp index 7f61b8cef1..3bda7af338 100644 --- a/src/servers/app/drawing/DrawingEngine.cpp +++ b/src/servers/app/drawing/DrawingEngine.cpp @@ -46,8 +46,8 @@ make_rect_valid(BRect& rect) static inline void extend_by_stroke_width(BRect& rect, const DrawState* context) { - // "- 1.0" because if stroke width == 1, we don't need to extend - float inset = -ceilf(context->PenSize() / 2.0 - 1.0); + // "- 0.5" because if stroke width == 1, we don't need to extend + float inset = -ceilf(context->PenSize() / 2.0 - 0.5); rect.InsetBy(inset, inset); } @@ -507,6 +507,7 @@ DrawingEngine::DrawEllipse(BRect r, const DrawState *d, bool filled) make_rect_valid(r); BRect clipped = r; fPainter->AlignEllipseRect(&clipped, filled); + if (!filled) extend_by_stroke_width(clipped, d); @@ -516,6 +517,7 @@ DrawingEngine::DrawEllipse(BRect r, const DrawState *d, bool filled) clipped.bottom = ceilf(clipped.bottom); clipped = fPainter->ClipRect(clipped); + if (clipped.IsValid()) { fGraphicsCard->HideSoftwareCursor(clipped); @@ -674,7 +676,7 @@ DrawingEngine::FillRegion(BRegion& r, const RGBColor& color) fPainter->FillRectNoClipping(r.RectAt(i), color.GetColor32()); } - fGraphicsCard->Invalidate(r.Frame()); + fGraphicsCard->Invalidate(frame); } if (cursorTouched) @@ -908,7 +910,7 @@ DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end, DrawState* con fGraphicsCard->HideSoftwareCursor(touched); fPainter->SetDrawState(context); - touched = fPainter->StrokeLine(start, end); + fPainter->StrokeLine(start, end); fGraphicsCard->Invalidate(touched); fGraphicsCard->ShowSoftwareCursor();