I couldn't resist playing some more with ezprof. I don't know if I can trust it's results though, revealing as they are. Somebody should explain to me why forgetting a return *this; in an operator= method works in the first place, and why it results in the constructor being called.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15255 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-11-30 23:03:05 +00:00
parent b32a299f2a
commit d0e89d5302
3 changed files with 21 additions and 8 deletions
@@ -14,7 +14,7 @@
// constructor // constructor
Desktop::Desktop(DrawView* drawView) Desktop::Desktop(DrawView* drawView)
: BLooper("desktop"), : BLooper("desktop", B_URGENT_DISPLAY_PRIORITY),
fTracking(false), fTracking(false),
fLastMousePos(-1.0, -1.0), fLastMousePos(-1.0, -1.0),
fClickedWindow(NULL), fClickedWindow(NULL),
@@ -144,13 +144,13 @@ Desktop::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
if (dx != 0 || dy != 0) { if (dx != 0 || dy != 0) {
if (fClickedWindow) { if (fClickedWindow) {
bigtime_t now = system_time(); //bigtime_t now = system_time();
if (fResizing) { if (fResizing) {
ResizeWindowBy(fClickedWindow, dx, dy); ResizeWindowBy(fClickedWindow, dx, dy);
printf("resizing: %lld\n", system_time() - now); //printf("resizing: %lld\n", system_time() - now);
} else { } else {
MoveWindowBy(fClickedWindow, dx, dy); MoveWindowBy(fClickedWindow, dx, dy);
printf("moving: %lld\n", system_time() - now); //printf("moving: %lld\n", system_time() - now);
} }
} }
} }
@@ -155,7 +155,19 @@ void
WindowLayer::GetBorderRegion(BRegion* region) WindowLayer::GetBorderRegion(BRegion* region)
{ {
if (!fBorderRegionValid) { if (!fBorderRegionValid) {
// TODO: speed up by avoiding "Exclude()" fBorderRegion.Set(BRect(fFrame.left - 4, fFrame.top - 20,
(fFrame.left + fFrame.right) / 2, fFrame.top - 5));
fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.top - 4,
fFrame.right + 4, fFrame.top - 1));
fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.top,
fFrame.left - 1, fFrame.bottom));
fBorderRegion.Include(BRect(fFrame.right + 1, fFrame.top,
fFrame.right + 4, fFrame.bottom - 11));
fBorderRegion.Include(BRect(fFrame.left - 4, fFrame.bottom + 1,
fFrame.right - 11, fFrame.bottom + 4));
fBorderRegion.Include(BRect(fFrame.right - 10, fFrame.bottom - 10,
fFrame.right + 4, fFrame.bottom + 4));
/* // TODO: speed up by avoiding "Exclude()"
// start from the frame, extend to include decorator border // start from the frame, extend to include decorator border
fBorderRegion.Set(BRect(fFrame.left - 4, fFrame.top - 4, fBorderRegion.Set(BRect(fFrame.left - 4, fFrame.top - 4,
fFrame.right + 4, fFrame.bottom + 4)); fFrame.right + 4, fFrame.bottom + 4));
@@ -169,7 +181,7 @@ WindowLayer::GetBorderRegion(BRegion* region)
// resize handle // resize handle
// if (B_DOCUMENT_WINDOW_LOOK) // if (B_DOCUMENT_WINDOW_LOOK)
fBorderRegion.Include(BRect(fFrame.right - 10, fFrame.bottom - 10, fBorderRegion.Include(BRect(fFrame.right - 10, fFrame.bottom - 10,
fFrame.right, fFrame.bottom)); fFrame.right, fFrame.bottom));*/
fBorderRegionValid = true; fBorderRegionValid = true;
} }
@@ -779,6 +791,7 @@ UpdateSession::operator=(const UpdateSession& other)
{ {
fDirtyRegion = other.fDirtyRegion; fDirtyRegion = other.fDirtyRegion;
fInUse = other.fInUse; fInUse = other.fInUse;
return *this;
} }
+2 -2
View File
@@ -181,14 +181,14 @@ Window::Test()
AddWindow(frame, name.String()); AddWindow(frame, name.String());
} }
frame.Set(10, 80, 320, 290); /* frame.Set(10, 80, 320, 290);
for (int32 i = 20; i < 40; i++) { for (int32 i = 20; i < 40; i++) {
BString name("Window "); BString name("Window ");
frame.OffsetBy(20, 15); frame.OffsetBy(20, 15);
name << i + 1; name << i + 1;
AddWindow(frame, name.String()); AddWindow(frame, name.String());
} }
/*
frame.Set(20, 140, 330, 230); frame.Set(20, 140, 330, 230);
for (int32 i = 40; i < 60; i++) { for (int32 i = 40; i < 60; i++) {
BString name("Window "); BString name("Window ");