support drawing invalid rects
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12422 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -547,10 +547,13 @@ DisplayDriverPainter::FillRect(const BRect &r, const RGBColor &color)
|
|||||||
{
|
{
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
|
|
||||||
fPainter->SetHighColor(color);
|
fPainter->FillRect(r, color.GetColor32());
|
||||||
BRect touched = fPainter->FillRect(r);
|
BRect touched(min_c(r.left, r.right),
|
||||||
|
min_c(r.top, r.bottom),
|
||||||
|
max_c(r.left, r.right),
|
||||||
|
max_c(r.top, r.bottom));
|
||||||
|
|
||||||
fGraphicsCard->Invalidate(touched);
|
fGraphicsCard->Invalidate(fPainter->ClipRect(touched));
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -712,7 +715,11 @@ DisplayDriverPainter::StrokeLine(const BPoint &start, const BPoint &end, const R
|
|||||||
context.draw_mode = B_OP_COPY;
|
context.draw_mode = B_OP_COPY;
|
||||||
StrokeLine(start, end, &context);
|
StrokeLine(start, end, &context);
|
||||||
} else {
|
} else {
|
||||||
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(start, end)));
|
BRect touched(min_c(start.x, end.x),
|
||||||
|
min_c(start.y, end.y),
|
||||||
|
max_c(start.x, end.x),
|
||||||
|
max_c(start.y, end.y));
|
||||||
|
fGraphicsCard->Invalidate(fPainter->ClipRect(touched));
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -769,16 +776,22 @@ void
|
|||||||
DisplayDriverPainter::StrokeRect(const BRect &r, const RGBColor &color)
|
DisplayDriverPainter::StrokeRect(const BRect &r, const RGBColor &color)
|
||||||
{
|
{
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
fPainter->StrokeRect(r, color.GetColor32());
|
// support invalid rects
|
||||||
|
BRect vr(min_c(r.left, r.right),
|
||||||
|
min_c(r.top, r.bottom),
|
||||||
|
max_c(r.left, r.right),
|
||||||
|
max_c(r.top, r.bottom));
|
||||||
|
|
||||||
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(r.left, r.top,
|
fPainter->StrokeRect(vr, color.GetColor32());
|
||||||
r.right, r.top)));
|
|
||||||
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(r.left, r.top + 1,
|
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(vr.left, vr.top,
|
||||||
r.left, r.bottom - 1)));
|
vr.right, vr.top)));
|
||||||
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(r.right, r.top + 1,
|
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(vr.left, vr.top + 1,
|
||||||
r.right, r.bottom - 1)));
|
vr.left, vr.bottom - 1)));
|
||||||
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(r.left, r.bottom,
|
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(vr.right, vr.top + 1,
|
||||||
r.right, r.bottom)));
|
vr.right, vr.bottom - 1)));
|
||||||
|
fGraphicsCard->Invalidate(fPainter->ClipRect(BRect(vr.left, vr.bottom,
|
||||||
|
vr.right, vr.bottom)));
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,6 @@ Painter::StrokeLine(BPoint a, BPoint b, DrawData* context)
|
|||||||
return _Clipped(touched);
|
return _Clipped(touched);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("StrokeLine((%.2f, %.2f)->(%.2f, %.2f)) -> AGG version\n", a.x, a.y, b.x, b.y);
|
|
||||||
// do the pixel center offset here
|
// do the pixel center offset here
|
||||||
a.x += 0.5;
|
a.x += 0.5;
|
||||||
a.y += 0.5;
|
a.y += 0.5;
|
||||||
@@ -529,8 +528,9 @@ Painter::FillShape(/*const */BShape* shape) const
|
|||||||
BRect
|
BRect
|
||||||
Painter::StrokeRect(const BRect& r) const
|
Painter::StrokeRect(const BRect& r) const
|
||||||
{
|
{
|
||||||
BPoint a(r.left, r.top);
|
// support invalid rects
|
||||||
BPoint b(r.right, r.bottom);
|
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));
|
||||||
_Transform(&a);
|
_Transform(&a);
|
||||||
_Transform(&b);
|
_Transform(&b);
|
||||||
|
|
||||||
@@ -579,8 +579,9 @@ Painter::StrokeRect(const BRect& r, const rgb_color& c) const
|
|||||||
BRect
|
BRect
|
||||||
Painter::FillRect(const BRect& r) const
|
Painter::FillRect(const BRect& r) const
|
||||||
{
|
{
|
||||||
BPoint a(r.left, r.top);
|
// support invalid rects
|
||||||
BPoint b(r.right, r.bottom);
|
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));
|
||||||
_Transform(&a, false);
|
_Transform(&a, false);
|
||||||
_Transform(&b, false);
|
_Transform(&b, false);
|
||||||
|
|
||||||
@@ -990,8 +991,8 @@ BRect
|
|||||||
Painter::_Clipped(const BRect& rect) const
|
Painter::_Clipped(const BRect& rect) const
|
||||||
{
|
{
|
||||||
if (rect.IsValid() && fClippingRegion)
|
if (rect.IsValid() && fClippingRegion)
|
||||||
return rect & fClippingRegion->Frame();
|
return BRect(rect & fClippingRegion->Frame());
|
||||||
return rect;
|
return BRect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _UpdateFont
|
// _UpdateFont
|
||||||
|
|||||||
Reference in New Issue
Block a user