hefty overall drawing speed optimizazion, the Draw() hook was called for every view down the hirarchy when one single child had to redraw, added some TODOs in _Draw about some stuff we need to think about
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15388 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+21
-11
@@ -4100,6 +4100,7 @@ BView::_Detach()
|
|||||||
AllDetached();
|
AllDetached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::_Draw(BRect updateRect)
|
BView::_Draw(BRect updateRect)
|
||||||
@@ -4110,19 +4111,24 @@ BView::_Draw(BRect updateRect)
|
|||||||
check_lock();
|
check_lock();
|
||||||
|
|
||||||
if (Flags() & B_WILL_DRAW) {
|
if (Flags() & B_WILL_DRAW) {
|
||||||
// TODO: make states robust
|
// find out if we should draw at all
|
||||||
PushState();
|
// TODO: can we optimize this some more? Should the app_server
|
||||||
Draw(updateRect);
|
// really send _UPDATE_ requests for all dirty views separately?
|
||||||
PopState();
|
BRegion updateRegion(updateRect);
|
||||||
|
for (BView *child = fFirstChild; child != NULL; child = child->fNextSibling) {
|
||||||
|
updateRegion.Exclude(child->Frame());
|
||||||
|
if (updateRegion.CountRects() == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (updateRegion.CountRects() > 0) {
|
||||||
|
// TODO: make states robust
|
||||||
|
PushState();
|
||||||
|
Draw(updateRect);
|
||||||
|
PopState();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// The code below is certainly not correct, because
|
// TODO: Find out what happens on R5 if a view has ViewColor() =
|
||||||
// it redoes what the app_server already did
|
|
||||||
// Find out what happens on R5 if a view has ViewColor() =
|
|
||||||
// B_TRANSPARENT_COLOR but not B_WILL_DRAW
|
// B_TRANSPARENT_COLOR but not B_WILL_DRAW
|
||||||
/* rgb_color c = aView->HighColor();
|
|
||||||
aView->SetHighColor(aView->ViewColor());
|
|
||||||
aView->FillRect(aView->Bounds(), B_SOLID_HIGH);
|
|
||||||
aView->SetHighColor(c);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BView *child = fFirstChild; child != NULL; child = child->fNextSibling) {
|
for (BView *child = fFirstChild; child != NULL; child = child->fNextSibling) {
|
||||||
@@ -4138,6 +4144,10 @@ BView::_Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Flags() & B_WILL_DRAW) {
|
if (Flags() & B_WILL_DRAW) {
|
||||||
|
// TODO: Since we have hard clipping in the app_server,
|
||||||
|
// a view can never draw "on top of it's child views" as
|
||||||
|
// the BeBook describes.
|
||||||
|
// (TODO: Test if this is really possible in BeOS.)
|
||||||
PushState();
|
PushState();
|
||||||
DrawAfterChildren(updateRect);
|
DrawAfterChildren(updateRect);
|
||||||
PopState();
|
PopState();
|
||||||
|
|||||||
Reference in New Issue
Block a user