* Adopt the code to handle the case that even a HWInterface instance with

hardware accelerated functions could be double buffered.
* Align the rectangle used for arc drawing like those for ellipsis.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26544 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-07-21 12:40:46 +00:00
parent 328699e5f6
commit 576305a5d8
+36 -22
View File
@@ -526,8 +526,11 @@ DrawingEngine::CopyRegion(/*const*/ BRegion* region,
}
// trigger the HW accelerated version if is was available
if (sortedRectList)
if (sortedRectList) {
fGraphicsCard->CopyRegion(sortedRectList, count, xOffset, yOffset);
if (fGraphicsCard->IsDoubleBuffered())
fGraphicsCard->Invalidate(region->Frame());
}
delete[] sortedRectList;
}
@@ -540,7 +543,9 @@ DrawingEngine::InvertRect(BRect r)
make_rect_valid(r);
r = fPainter->ClipRect(r);
if (r.IsValid()) {
if (!r.IsValid())
return;
AutoFloatingOverlaysHider _(fGraphicsCard, r);
// try hardware optimized version first
@@ -548,12 +553,12 @@ DrawingEngine::InvertRect(BRect r)
BRegion region(r);
region.IntersectWith(fPainter->ClippingRegion());
fGraphicsCard->InvertRegion(region);
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(r);
} else {
fPainter->InvertRect(r);
_CopyToFront(r);
}
}
}
// DrawBitmap
@@ -575,16 +580,20 @@ DrawingEngine::DrawBitmap(ServerBitmap *bitmap,
// DrawArc
void
DrawingEngine::DrawArc(BRect r, const float &angle,
const float &span, bool filled)
DrawingEngine::DrawArc(BRect r, const float &angle, const float &span,
bool filled)
{
CRASH_IF_NOT_LOCKED
make_rect_valid(r);
fPainter->AlignEllipseRect(&r, filled);
BRect clipped(r);
if (!filled)
extend_by_stroke_width(clipped, fPainter->PenSize());
clipped = fPainter->ClipRect(r);
if (clipped.IsValid()) {
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
@@ -731,7 +740,9 @@ DrawingEngine::FillRect(BRect r, const rgb_color& color)
// gut feeling.
make_rect_valid(r);
r = fPainter->ClipRect(r);
if (r.IsValid()) {
if (!r.IsValid())
return;
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
// try hardware optimized version first
@@ -739,14 +750,14 @@ DrawingEngine::FillRect(BRect r, const rgb_color& color)
BRegion region(r);
region.IntersectWith(fPainter->ClippingRegion());
fGraphicsCard->FillRegion(region, color,
fSuspendSyncLevel == 0
|| overlaysHider.WasHidden());
fSuspendSyncLevel == 0 || overlaysHider.WasHidden());
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(r);
} else {
fPainter->FillRect(r, color);
_CopyToFront(r);
}
}
}
@@ -778,11 +789,12 @@ DrawingEngine::FillRegion(BRegion& r, const rgb_color& color)
&& frame.Width() * frame.Height() > 100) {
fGraphicsCard->FillRegion(r, color, fSuspendSyncLevel == 0
|| overlaysHider.WasHidden());
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(frame);
} else {
int32 count = r.CountRects();
for (int32 i = 0; i < count; i++) {
for (int32 i = 0; i < count; i++)
fPainter->FillRectNoClipping(r.RectAtInt(i), color);
}
_CopyToFront(frame);
}
@@ -817,7 +829,9 @@ DrawingEngine::FillRect(BRect r)
make_rect_valid(r);
r = fPainter->AlignAndClipRect(r);
if (r.IsValid()) {
if (!r.IsValid())
return;
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
bool doInSoftware = true;
@@ -855,12 +869,11 @@ DrawingEngine::FillRect(BRect r)
doInSoftware = false;
}
if (doInSoftware) {
if (doInSoftware)
fPainter->FillRect(r);
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(r);
}
}
}
@@ -870,7 +883,9 @@ DrawingEngine::FillRegion(BRegion& r)
CRASH_IF_NOT_LOCKED
BRect clipped = fPainter->ClipRect(r.Frame());
if (clipped.IsValid()) {
if (!clipped.IsValid())
return;
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, clipped);
bool doInSoftware = true;
@@ -907,13 +922,12 @@ DrawingEngine::FillRegion(BRegion& r)
BRect touched = fPainter->FillRect(r.RectAt(0));
int32 count = r.CountRects();
for (int32 i = 1; i < count; i++) {
for (int32 i = 1; i < count; i++)
touched = touched | fPainter->FillRect(r.RectAt(i));
}
_CopyToFront(touched);
}
}
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(r.Frame());
}