* there was a complete mixup of "drawing origin" and "scrolling offset" in the
BView implementation (client side) * introduced some private methods for _Convert*(BPoint*) methods which avoid doing the check_lock() thing in the recursion, also Origin() would likely have communicated with the app_server all the time, since the origin bit was needlessly invalidated, so some speedup should be achieved * this should fix ticket #98 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21900 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -599,6 +599,13 @@ private:
|
|||||||
void _ResizeBy(int32 deltaWidth, int32 deltaHeight);
|
void _ResizeBy(int32 deltaWidth, int32 deltaHeight);
|
||||||
void _ParentResizedBy(int32 x, int32 y);
|
void _ParentResizedBy(int32 x, int32 y);
|
||||||
|
|
||||||
|
void _ConvertToScreen(BPoint* pt, bool checkLock) const;
|
||||||
|
void _ConvertFromScreen(BPoint* pt, bool checkLock) const;
|
||||||
|
|
||||||
|
void _ConvertToParent(BPoint* pt, bool checkLock) const;
|
||||||
|
void _ConvertFromParent(BPoint* pt, bool checkLock) const;
|
||||||
|
|
||||||
|
|
||||||
void _Activate(bool state);
|
void _Activate(bool state);
|
||||||
void _Attach();
|
void _Attach();
|
||||||
void _Detach();
|
void _Detach();
|
||||||
|
|||||||
+68
-50
@@ -628,20 +628,24 @@ BView::Bounds() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::ConvertToParent(BPoint *point) const
|
BView::_ConvertToParent(BPoint *point, bool checkLock) const
|
||||||
{
|
{
|
||||||
if (!fParent)
|
if (!fParent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (checkLock)
|
||||||
check_lock_no_pick();
|
check_lock_no_pick();
|
||||||
|
|
||||||
// TODO: handle scale
|
// - our scrolling offset
|
||||||
|
// + our bounds location within the parent
|
||||||
|
point->x += -fBounds.left + fParentOffset.x;
|
||||||
|
point->y += -fBounds.top + fParentOffset.y;
|
||||||
|
}
|
||||||
|
|
||||||
// our local coordinate transformation
|
void
|
||||||
*point -= Origin();
|
BView::ConvertToParent(BPoint *point) const
|
||||||
|
{
|
||||||
// our bounds location within the parent
|
_ConvertToParent(point, true);
|
||||||
*point += fParentOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -655,20 +659,24 @@ BView::ConvertToParent(BPoint point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::ConvertFromParent(BPoint *point) const
|
BView::_ConvertFromParent(BPoint *point, bool checkLock) const
|
||||||
{
|
{
|
||||||
if (!fParent)
|
if (!fParent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (checkLock)
|
||||||
check_lock_no_pick();
|
check_lock_no_pick();
|
||||||
|
|
||||||
// TODO: handle scale
|
// - our bounds location within the parent
|
||||||
|
// + our scrolling offset
|
||||||
|
point->x += -fParentOffset.x + fBounds.left;
|
||||||
|
point->y += -fParentOffset.y + fBounds.top;
|
||||||
|
}
|
||||||
|
|
||||||
// our bounds location within the parent
|
void
|
||||||
*point -= fParentOffset;
|
BView::ConvertFromParent(BPoint *point) const
|
||||||
|
{
|
||||||
// our local coordinate transformation
|
_ConvertFromParent(point, true);
|
||||||
*point += Origin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -689,15 +697,10 @@ BView::ConvertToParent(BRect *rect) const
|
|||||||
|
|
||||||
check_lock_no_pick();
|
check_lock_no_pick();
|
||||||
|
|
||||||
// TODO: handle scale
|
// - our scrolling offset
|
||||||
|
// + our bounds location within the parent
|
||||||
BPoint origin = Origin();
|
rect->OffsetBy(-fBounds.left + fParentOffset.x,
|
||||||
|
-fBounds.top + fParentOffset.y);
|
||||||
// our local coordinate transformation
|
|
||||||
rect->OffsetBy(-origin.x, -origin.y);
|
|
||||||
|
|
||||||
// our bounds location within the parent
|
|
||||||
rect->OffsetBy(fParentOffset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -718,13 +721,10 @@ BView::ConvertFromParent(BRect *rect) const
|
|||||||
|
|
||||||
check_lock_no_pick();
|
check_lock_no_pick();
|
||||||
|
|
||||||
// TODO: handle scale
|
// - our bounds location within the parent
|
||||||
|
// + our scrolling offset
|
||||||
// our bounds location within the parent
|
rect->OffsetBy(-fParentOffset.x + fBounds.left,
|
||||||
rect->OffsetBy(-fParentOffset.x, -fParentOffset.y);
|
-fParentOffset.y + fBounds.top);
|
||||||
|
|
||||||
// our local coordinate transformation
|
|
||||||
rect->OffsetBy(Origin());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ BView::ConvertFromParent(BRect rect) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::ConvertToScreen(BPoint *pt) const
|
BView::_ConvertToScreen(BPoint *pt, bool checkLock) const
|
||||||
{
|
{
|
||||||
if (!fParent) {
|
if (!fParent) {
|
||||||
if (fOwner)
|
if (fOwner)
|
||||||
@@ -747,10 +747,18 @@ BView::ConvertToScreen(BPoint *pt) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkLock)
|
||||||
do_owner_check_no_pick();
|
do_owner_check_no_pick();
|
||||||
|
|
||||||
ConvertToParent(pt);
|
_ConvertToParent(pt, false);
|
||||||
fParent->ConvertToScreen(pt);
|
fParent->_ConvertToScreen(pt, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::ConvertToScreen(BPoint *pt) const
|
||||||
|
{
|
||||||
|
_ConvertToScreen(pt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -764,7 +772,7 @@ BView::ConvertToScreen(BPoint pt) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::ConvertFromScreen(BPoint *pt) const
|
BView::_ConvertFromScreen(BPoint *pt, bool checkLock) const
|
||||||
{
|
{
|
||||||
if (!fParent) {
|
if (!fParent) {
|
||||||
if (fOwner)
|
if (fOwner)
|
||||||
@@ -773,10 +781,17 @@ BView::ConvertFromScreen(BPoint *pt) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkLock)
|
||||||
do_owner_check_no_pick();
|
do_owner_check_no_pick();
|
||||||
|
|
||||||
ConvertFromParent(pt);
|
_ConvertFromParent(pt, false);
|
||||||
fParent->ConvertFromScreen(pt);
|
fParent->_ConvertFromScreen(pt, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::ConvertFromScreen(BPoint *pt) const
|
||||||
|
{
|
||||||
|
_ConvertFromScreen(pt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -976,6 +991,9 @@ BView::SetOrigin(float x, float y)
|
|||||||
&& x == fState->origin.x && y == fState->origin.y)
|
&& x == fState->origin.x && y == fState->origin.y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fState->origin.x = x;
|
||||||
|
fState->origin.y = y;
|
||||||
|
|
||||||
if (do_owner_check()) {
|
if (do_owner_check()) {
|
||||||
fOwner->fLink->StartMessage(AS_LAYER_SET_ORIGIN);
|
fOwner->fLink->StartMessage(AS_LAYER_SET_ORIGIN);
|
||||||
fOwner->fLink->Attach<float>(x);
|
fOwner->fLink->Attach<float>(x);
|
||||||
@@ -1539,7 +1557,7 @@ BView::ScrollBy(float deltaX, float deltaY)
|
|||||||
|
|
||||||
fOwner->fLink->Flush();
|
fOwner->fLink->Flush();
|
||||||
|
|
||||||
fState->valid_flags &= ~(B_VIEW_FRAME_BIT | B_VIEW_ORIGIN_BIT);
|
// fState->valid_flags &= ~B_VIEW_FRAME_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we modify our bounds rectangle by deltaX/deltaY coord units hor/ver.
|
// we modify our bounds rectangle by deltaX/deltaY coord units hor/ver.
|
||||||
@@ -3572,7 +3590,7 @@ BView::MoveTo(float x, float y)
|
|||||||
fOwner->fLink->Attach<float>(x);
|
fOwner->fLink->Attach<float>(x);
|
||||||
fOwner->fLink->Attach<float>(y);
|
fOwner->fLink->Attach<float>(y);
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_FRAME_BIT;
|
// fState->valid_flags |= B_VIEW_FRAME_BIT;
|
||||||
|
|
||||||
_FlushIfNotInTransaction();
|
_FlushIfNotInTransaction();
|
||||||
}
|
}
|
||||||
@@ -3600,7 +3618,7 @@ BView::ResizeBy(float deltaWidth, float deltaHeight)
|
|||||||
fOwner->fLink->Attach<float>(fBounds.right + deltaWidth);
|
fOwner->fLink->Attach<float>(fBounds.right + deltaWidth);
|
||||||
fOwner->fLink->Attach<float>(fBounds.bottom + deltaHeight);
|
fOwner->fLink->Attach<float>(fBounds.bottom + deltaHeight);
|
||||||
|
|
||||||
fState->valid_flags |= B_VIEW_FRAME_BIT;
|
// fState->valid_flags |= B_VIEW_FRAME_BIT;
|
||||||
|
|
||||||
_FlushIfNotInTransaction();
|
_FlushIfNotInTransaction();
|
||||||
}
|
}
|
||||||
@@ -4652,17 +4670,17 @@ BView::_UpdateStateForRemove()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fState->UpdateFrom(*fOwner->fLink);
|
fState->UpdateFrom(*fOwner->fLink);
|
||||||
if (!fState->IsValid(B_VIEW_FRAME_BIT)) {
|
// if (!fState->IsValid(B_VIEW_FRAME_BIT)) {
|
||||||
fOwner->fLink->StartMessage(AS_LAYER_GET_COORD);
|
// fOwner->fLink->StartMessage(AS_LAYER_GET_COORD);
|
||||||
|
//
|
||||||
status_t code;
|
// status_t code;
|
||||||
if (fOwner->fLink->FlushWithReply(code) == B_OK
|
// if (fOwner->fLink->FlushWithReply(code) == B_OK
|
||||||
&& code == B_OK) {
|
// && code == B_OK) {
|
||||||
fOwner->fLink->Read<BPoint>(&fParentOffset);
|
// fOwner->fLink->Read<BPoint>(&fParentOffset);
|
||||||
fOwner->fLink->Read<BRect>(&fBounds);
|
// fOwner->fLink->Read<BRect>(&fBounds);
|
||||||
fState->valid_flags |= B_VIEW_FRAME_BIT;
|
// fState->valid_flags |= B_VIEW_FRAME_BIT;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// update children as well
|
// update children as well
|
||||||
|
|
||||||
|
|||||||
@@ -1381,8 +1381,8 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
// our offset in the parent -> will be originX and originY in BView
|
// our offset in the parent -> will be originX and originY in BView
|
||||||
fLink.Attach<float>(fCurrentLayer->Frame().left);
|
BPoint parentOffset = fCurrentLayer->Frame().LeftTop();
|
||||||
fLink.Attach<float>(fCurrentLayer->Frame().top);
|
fLink.Attach<BPoint>(parentOffset);
|
||||||
fLink.Attach<BRect>(fCurrentLayer->Bounds());
|
fLink.Attach<BRect>(fCurrentLayer->Bounds());
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
break;
|
break;
|
||||||
@@ -1403,9 +1403,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
{
|
{
|
||||||
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
// TODO: rename this where it is used in the BView code!
|
fLink.Attach<BPoint>(fCurrentLayer->DrawingOrigin());
|
||||||
// (it wants to know scrolling offset, not drawing origin)
|
|
||||||
fLink.Attach<BPoint>(fCurrentLayer->ScrollingOffset());
|
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user