* 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:
@@ -526,8 +526,11 @@ DrawingEngine::CopyRegion(/*const*/ BRegion* region,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// trigger the HW accelerated version if is was available
|
// trigger the HW accelerated version if is was available
|
||||||
if (sortedRectList)
|
if (sortedRectList) {
|
||||||
fGraphicsCard->CopyRegion(sortedRectList, count, xOffset, yOffset);
|
fGraphicsCard->CopyRegion(sortedRectList, count, xOffset, yOffset);
|
||||||
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
|
fGraphicsCard->Invalidate(region->Frame());
|
||||||
|
}
|
||||||
|
|
||||||
delete[] sortedRectList;
|
delete[] sortedRectList;
|
||||||
}
|
}
|
||||||
@@ -540,7 +543,9 @@ DrawingEngine::InvertRect(BRect r)
|
|||||||
|
|
||||||
make_rect_valid(r);
|
make_rect_valid(r);
|
||||||
r = fPainter->ClipRect(r);
|
r = fPainter->ClipRect(r);
|
||||||
if (r.IsValid()) {
|
if (!r.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, r);
|
AutoFloatingOverlaysHider _(fGraphicsCard, r);
|
||||||
|
|
||||||
// try hardware optimized version first
|
// try hardware optimized version first
|
||||||
@@ -548,12 +553,12 @@ DrawingEngine::InvertRect(BRect r)
|
|||||||
BRegion region(r);
|
BRegion region(r);
|
||||||
region.IntersectWith(fPainter->ClippingRegion());
|
region.IntersectWith(fPainter->ClippingRegion());
|
||||||
fGraphicsCard->InvertRegion(region);
|
fGraphicsCard->InvertRegion(region);
|
||||||
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
|
_CopyToFront(r);
|
||||||
} else {
|
} else {
|
||||||
fPainter->InvertRect(r);
|
fPainter->InvertRect(r);
|
||||||
|
|
||||||
_CopyToFront(r);
|
_CopyToFront(r);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawBitmap
|
// DrawBitmap
|
||||||
@@ -575,16 +580,20 @@ DrawingEngine::DrawBitmap(ServerBitmap *bitmap,
|
|||||||
|
|
||||||
// DrawArc
|
// DrawArc
|
||||||
void
|
void
|
||||||
DrawingEngine::DrawArc(BRect r, const float &angle,
|
DrawingEngine::DrawArc(BRect r, const float &angle, const float &span,
|
||||||
const float &span, bool filled)
|
bool filled)
|
||||||
{
|
{
|
||||||
CRASH_IF_NOT_LOCKED
|
CRASH_IF_NOT_LOCKED
|
||||||
|
|
||||||
make_rect_valid(r);
|
make_rect_valid(r);
|
||||||
|
fPainter->AlignEllipseRect(&r, filled);
|
||||||
BRect clipped(r);
|
BRect clipped(r);
|
||||||
|
|
||||||
if (!filled)
|
if (!filled)
|
||||||
extend_by_stroke_width(clipped, fPainter->PenSize());
|
extend_by_stroke_width(clipped, fPainter->PenSize());
|
||||||
|
|
||||||
clipped = fPainter->ClipRect(r);
|
clipped = fPainter->ClipRect(r);
|
||||||
|
|
||||||
if (clipped.IsValid()) {
|
if (clipped.IsValid()) {
|
||||||
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider _(fGraphicsCard, clipped);
|
||||||
|
|
||||||
@@ -731,7 +740,9 @@ DrawingEngine::FillRect(BRect r, const rgb_color& color)
|
|||||||
// gut feeling.
|
// gut feeling.
|
||||||
make_rect_valid(r);
|
make_rect_valid(r);
|
||||||
r = fPainter->ClipRect(r);
|
r = fPainter->ClipRect(r);
|
||||||
if (r.IsValid()) {
|
if (!r.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
||||||
|
|
||||||
// try hardware optimized version first
|
// try hardware optimized version first
|
||||||
@@ -739,14 +750,14 @@ DrawingEngine::FillRect(BRect r, const rgb_color& color)
|
|||||||
BRegion region(r);
|
BRegion region(r);
|
||||||
region.IntersectWith(fPainter->ClippingRegion());
|
region.IntersectWith(fPainter->ClippingRegion());
|
||||||
fGraphicsCard->FillRegion(region, color,
|
fGraphicsCard->FillRegion(region, color,
|
||||||
fSuspendSyncLevel == 0
|
fSuspendSyncLevel == 0 || overlaysHider.WasHidden());
|
||||||
|| overlaysHider.WasHidden());
|
|
||||||
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
|
_CopyToFront(r);
|
||||||
} else {
|
} else {
|
||||||
fPainter->FillRect(r, color);
|
fPainter->FillRect(r, color);
|
||||||
|
|
||||||
_CopyToFront(r);
|
_CopyToFront(r);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -778,11 +789,12 @@ DrawingEngine::FillRegion(BRegion& r, const rgb_color& color)
|
|||||||
&& frame.Width() * frame.Height() > 100) {
|
&& frame.Width() * frame.Height() > 100) {
|
||||||
fGraphicsCard->FillRegion(r, color, fSuspendSyncLevel == 0
|
fGraphicsCard->FillRegion(r, color, fSuspendSyncLevel == 0
|
||||||
|| overlaysHider.WasHidden());
|
|| overlaysHider.WasHidden());
|
||||||
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
|
_CopyToFront(frame);
|
||||||
} else {
|
} else {
|
||||||
int32 count = r.CountRects();
|
int32 count = r.CountRects();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++)
|
||||||
fPainter->FillRectNoClipping(r.RectAtInt(i), color);
|
fPainter->FillRectNoClipping(r.RectAtInt(i), color);
|
||||||
}
|
|
||||||
|
|
||||||
_CopyToFront(frame);
|
_CopyToFront(frame);
|
||||||
}
|
}
|
||||||
@@ -817,7 +829,9 @@ DrawingEngine::FillRect(BRect r)
|
|||||||
|
|
||||||
make_rect_valid(r);
|
make_rect_valid(r);
|
||||||
r = fPainter->AlignAndClipRect(r);
|
r = fPainter->AlignAndClipRect(r);
|
||||||
if (r.IsValid()) {
|
if (!r.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, r);
|
||||||
|
|
||||||
bool doInSoftware = true;
|
bool doInSoftware = true;
|
||||||
@@ -855,12 +869,11 @@ DrawingEngine::FillRect(BRect r)
|
|||||||
doInSoftware = false;
|
doInSoftware = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doInSoftware) {
|
if (doInSoftware)
|
||||||
fPainter->FillRect(r);
|
fPainter->FillRect(r);
|
||||||
|
|
||||||
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
_CopyToFront(r);
|
_CopyToFront(r);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -870,7 +883,9 @@ DrawingEngine::FillRegion(BRegion& r)
|
|||||||
CRASH_IF_NOT_LOCKED
|
CRASH_IF_NOT_LOCKED
|
||||||
|
|
||||||
BRect clipped = fPainter->ClipRect(r.Frame());
|
BRect clipped = fPainter->ClipRect(r.Frame());
|
||||||
if (clipped.IsValid()) {
|
if (!clipped.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, clipped);
|
AutoFloatingOverlaysHider overlaysHider(fGraphicsCard, clipped);
|
||||||
|
|
||||||
bool doInSoftware = true;
|
bool doInSoftware = true;
|
||||||
@@ -907,13 +922,12 @@ DrawingEngine::FillRegion(BRegion& r)
|
|||||||
BRect touched = fPainter->FillRect(r.RectAt(0));
|
BRect touched = fPainter->FillRect(r.RectAt(0));
|
||||||
|
|
||||||
int32 count = r.CountRects();
|
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));
|
touched = touched | fPainter->FillRect(r.RectAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
_CopyToFront(touched);
|
if (fGraphicsCard->IsDoubleBuffered())
|
||||||
}
|
_CopyToFront(r.Frame());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user