* origin in DrawState is now the summed up origin, when setting it,

use the origin from the previous state as a start
* this fixes scrolling again (minus redrawing too much stuff,
  this is left for Adi :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14770 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-11-08 01:16:15 +00:00
parent db103be7cf
commit 971ed3de1e
3 changed files with 10 additions and 11 deletions

View File

@ -268,7 +268,7 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const
void
DrawState::SetOrigin(const BPoint& origin)
{
fOrigin = origin;
fOrigin = fPreviousState ? fPreviousState->fOrigin + origin : origin;
}
@ -371,6 +371,8 @@ DrawState::PenLocation() const
void
DrawState::SetPenSize(float size)
{
// NOTE: since pensize is calculated on the fly,
// it is ok to set it here regardless of previous state
fPenSize = size;
}

View File

@ -712,13 +712,14 @@ Layer::Activated(bool active)
BPoint
Layer::BoundsOrigin() const
{
BPoint origin(0, 0);
BPoint origin(fDrawState->Origin());
float scale = Scale();
DrawState* layerData = fDrawState;
do {
origin += layerData->Origin();
} while ((layerData = layerData->PreviousState()) != NULL);
// TODO: Figure this out, BoundsOrigin()
// is used for BView::Bounds(), but I think
// that the scale has nothing to do with it
// "local coordinate system origin" does have
// something to do with scale.
origin.x *= scale;
origin.y *= scale;
@ -1473,7 +1474,6 @@ void Layer::do_MoveBy(float dx, float dy)
if (dx == 0.0f && dy == 0.0f)
return;
// fFrame.Set(fFrame.left+dx, fFrame.top+dy, fFrame.right+dx, fFrame.bottom+dy);
fFrame.OffsetBy(dx, dy);
// call hook function
@ -1552,8 +1552,6 @@ Layer::do_ScrollBy(float dx, float dy)
if (dx != 0.0f || dy != 0.0f)
ScrolledByHook(dx, dy);
SendViewCoordUpdateMsg();
}
void

View File

@ -765,8 +765,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// our offset in the parent -> will be originX and originY in BView
fLink.Attach<float>(fCurrentLayer->fFrame.left);
fLink.Attach<float>(fCurrentLayer->fFrame.top);
// convert frame to bounds
fLink.Attach<BRect>(fCurrentLayer->fFrame.OffsetToCopy(fCurrentLayer->BoundsOrigin()));
fLink.Attach<BRect>(fCurrentLayer->Bounds());
fLink.Flush();
break;
}