* 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
This commit is contained in:
Stephan Aßmus 2006-09-14 18:03:39 +00:00
parent ae540011ed
commit 846cc588f2
1 changed files with 6 additions and 4 deletions

View File

@ -46,8 +46,8 @@ make_rect_valid(BRect& rect)
static inline void static inline void
extend_by_stroke_width(BRect& rect, const DrawState* context) extend_by_stroke_width(BRect& rect, const DrawState* context)
{ {
// "- 1.0" because if stroke width == 1, we don't need to extend // "- 0.5" because if stroke width == 1, we don't need to extend
float inset = -ceilf(context->PenSize() / 2.0 - 1.0); float inset = -ceilf(context->PenSize() / 2.0 - 0.5);
rect.InsetBy(inset, inset); rect.InsetBy(inset, inset);
} }
@ -507,6 +507,7 @@ DrawingEngine::DrawEllipse(BRect r, const DrawState *d, bool filled)
make_rect_valid(r); make_rect_valid(r);
BRect clipped = r; BRect clipped = r;
fPainter->AlignEllipseRect(&clipped, filled); fPainter->AlignEllipseRect(&clipped, filled);
if (!filled) if (!filled)
extend_by_stroke_width(clipped, d); 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.bottom = ceilf(clipped.bottom);
clipped = fPainter->ClipRect(clipped); clipped = fPainter->ClipRect(clipped);
if (clipped.IsValid()) { if (clipped.IsValid()) {
fGraphicsCard->HideSoftwareCursor(clipped); fGraphicsCard->HideSoftwareCursor(clipped);
@ -674,7 +676,7 @@ DrawingEngine::FillRegion(BRegion& r, const RGBColor& color)
fPainter->FillRectNoClipping(r.RectAt(i), color.GetColor32()); fPainter->FillRectNoClipping(r.RectAt(i), color.GetColor32());
} }
fGraphicsCard->Invalidate(r.Frame()); fGraphicsCard->Invalidate(frame);
} }
if (cursorTouched) if (cursorTouched)
@ -908,7 +910,7 @@ DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end, DrawState* con
fGraphicsCard->HideSoftwareCursor(touched); fGraphicsCard->HideSoftwareCursor(touched);
fPainter->SetDrawState(context); fPainter->SetDrawState(context);
touched = fPainter->StrokeLine(start, end); fPainter->StrokeLine(start, end);
fGraphicsCard->Invalidate(touched); fGraphicsCard->Invalidate(touched);
fGraphicsCard->ShowSoftwareCursor(); fGraphicsCard->ShowSoftwareCursor();