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
+31 -24
View File
@@ -864,40 +864,47 @@ void
ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
BRegion* windowContentClipping, bool deep) BRegion* windowContentClipping, bool deep)
{ {
// we can only draw within our own area if (fViewBitmap != NULL || !fViewColor.IsTransparentMagic()) {
BRegion redraw(ScreenClipping(windowContentClipping)); // we can only draw within our own area
// add the current clipping BRegion redraw(ScreenClipping(windowContentClipping));
redraw.IntersectWith(effectiveClipping); // add the current clipping
redraw.IntersectWith(effectiveClipping);
if (fViewBitmap != NULL) { if (fViewBitmap != NULL) {
// draw view bitmap // draw view bitmap
// TODO: support other options! // TODO: support other options!
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
drawingEngine->ConstrainClippingRegion(&redraw); // to be valid
// TODO: fDrawState is probably not what we want to use here... if (drawingEngine->Lock()) {
drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource, drawingEngine->ConstrainClippingRegion(&redraw);
rect, fDrawState);
drawingEngine->ConstrainClippingRegion(NULL);
redraw.Exclude(rect); DrawState defaultDrawState;
} drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource,
rect, &defaultDrawState);
// NOTE: It is ok not to reset the clipping, that
// would only waste time
drawingEngine->Unlock();
}
if (!fViewColor.IsTransparentMagic()) { redraw.Exclude(rect);
// fill visible region with view color }
drawingEngine->FillRegion(redraw, fViewColor);
if (!fViewColor.IsTransparentMagic()) {
// 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);
}
} }
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);