* DrawingEngine::CopyBits() was invalidating the wrong region (without offset)

when the HWInterface was using acceleration and at the same time double
  buffering.
* _CopyToFront() should always be used, since it calls a protected virtual that
  derived classes of HWInterface depend on. This fixes some graphics glitches
  in certain situations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28300 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-10-23 17:02:46 +00:00
parent c92e0a11c0
commit 8b8e062daa
+16 -23
View File
@@ -524,11 +524,13 @@ DrawingEngine::CopyRegion(/*const*/ BRegion* region,
} }
} }
// trigger the HW accelerated version if is was available // trigger the HW accelerated version if it was available
if (sortedRectList) { if (sortedRectList) {
fGraphicsCard->CopyRegion(sortedRectList, count, xOffset, yOffset); fGraphicsCard->CopyRegion(sortedRectList, count, xOffset, yOffset);
if (fGraphicsCard->IsDoubleBuffered()) if (fGraphicsCard->IsDoubleBuffered()) {
fGraphicsCard->Invalidate(region->Frame()); fGraphicsCard->Invalidate(
region->Frame().OffsetByCopy(xOffset, yOffset));
}
} }
delete[] sortedRectList; delete[] sortedRectList;
@@ -552,12 +554,11 @@ 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
@@ -836,13 +837,11 @@ DrawingEngine::FillRect(BRect r, const rgb_color& color)
region.IntersectWith(fPainter->ClippingRegion()); region.IntersectWith(fPainter->ClippingRegion());
fGraphicsCard->FillRegion(region, color, fGraphicsCard->FillRegion(region, color,
fSuspendSyncLevel == 0 || overlaysHider.WasHidden()); fSuspendSyncLevel == 0 || overlaysHider.WasHidden());
if (fGraphicsCard->IsDoubleBuffered())
_CopyToFront(r);
} else { } else {
fPainter->FillRect(r, color); fPainter->FillRect(r, color);
_CopyToFront(r);
} }
_CopyToFront(r);
} }
@@ -873,16 +872,14 @@ DrawingEngine::FillRegion(BRegion& r, const rgb_color& color)
if ((fAvailableHWAccleration & HW_ACC_FILL_REGION) != 0 if ((fAvailableHWAccleration & HW_ACC_FILL_REGION) != 0
&& 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);
} }
// #pragma mark - DrawState // #pragma mark - DrawState
@@ -957,8 +954,7 @@ DrawingEngine::FillRect(BRect r)
if (doInSoftware) if (doInSoftware)
fPainter->FillRect(r); fPainter->FillRect(r);
if (fGraphicsCard->IsDoubleBuffered()) _CopyToFront(r);
_CopyToFront(r);
} }
@@ -976,8 +972,7 @@ DrawingEngine::FillRectGradient(BRect r, const BGradient& gradient)
fPainter->FillRectGradient(r, gradient); fPainter->FillRectGradient(r, gradient);
if (fGraphicsCard->IsDoubleBuffered()) _CopyToFront(r);
_CopyToFront(r);
} }
@@ -1030,8 +1025,7 @@ DrawingEngine::FillRegion(BRegion& r)
touched = touched | fPainter->FillRect(r.RectAt(i)); touched = touched | fPainter->FillRect(r.RectAt(i));
} }
if (fGraphicsCard->IsDoubleBuffered()) _CopyToFront(r.Frame());
_CopyToFront(r.Frame());
} }
@@ -1052,8 +1046,7 @@ DrawingEngine::FillRegionGradient(BRegion& r, const BGradient& gradient)
for (int32 i = 1; i < count; i++) for (int32 i = 1; i < count; i++)
touched = touched | fPainter->FillRectGradient(r.RectAt(i), gradient); touched = touched | fPainter->FillRectGradient(r.RectAt(i), gradient);
if (fGraphicsCard->IsDoubleBuffered()) _CopyToFront(r.Frame());
_CopyToFront(r.Frame());
} }