removed some of Axels TODOs and added some notes, avoid clipping operations if nothing needs to be drawn

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-12-29 19:30:48 +00:00
parent fe161a0740
commit 8d66d23e83
+16 -9
View File
@@ -864,6 +864,7 @@ void
ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
BRegion* windowContentClipping, bool deep) BRegion* windowContentClipping, bool deep)
{ {
if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) {
// we can only draw within our own area // we can only draw within our own area
BRegion redraw(ScreenClipping(windowContentClipping)); BRegion redraw(ScreenClipping(windowContentClipping));
// add the current clipping // add the current clipping
@@ -875,29 +876,35 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
BRect rect = fBitmapDestination; BRect rect = fBitmapDestination;
ConvertToScreenForDrawing(&rect); ConvertToScreenForDrawing(&rect);
// TODO: this messes with the screen clipping, but might not be supposed to do so. // lock the drawing engine for as long as we need the clipping
// to be valid
if (drawingEngine->Lock()) {
drawingEngine->ConstrainClippingRegion(&redraw); drawingEngine->ConstrainClippingRegion(&redraw);
// TODO: fDrawState is probably not what we want to use here...
DrawState defaultDrawState;
drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource, drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource,
rect, fDrawState); rect, &defaultDrawState);
drawingEngine->ConstrainClippingRegion(NULL); // NOTE: It is ok not to reset the clipping, that
// would only waste time
drawingEngine->Unlock();
}
redraw.Exclude(rect); redraw.Exclude(rect);
} }
if (!fViewColor.IsTransparentMagic()) { if (!fViewColor.IsTransparentMagic()) {
// fill visible region with view color // fill visible region with view color,
// this version of FillRegion ignores any
// clipping, that's why "redraw" needs to
// be correct
drawingEngine->FillRegion(redraw, fViewColor); drawingEngine->FillRegion(redraw, fViewColor);
} }
}
fBackgroundDirty = false; fBackgroundDirty = false;
// let children draw // let children draw
if (deep) { if (deep) {
// before passing the clipping on to children, exclude our
// own region from the available clipping
effectiveClipping->Exclude(&fScreenClipping);
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) { for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
child->Draw(drawingEngine, effectiveClipping, child->Draw(drawingEngine, effectiveClipping,
windowContentClipping, deep); windowContentClipping, deep);