* 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
+3 -1
View File
@@ -268,7 +268,7 @@ DrawState::WriteToLink(BPrivate::LinkSender& link) const
void void
DrawState::SetOrigin(const BPoint& origin) DrawState::SetOrigin(const BPoint& origin)
{ {
fOrigin = origin; fOrigin = fPreviousState ? fPreviousState->fOrigin + origin : origin;
} }
@@ -371,6 +371,8 @@ DrawState::PenLocation() const
void void
DrawState::SetPenSize(float size) 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; fPenSize = size;
} }
+6 -8
View File
@@ -712,13 +712,14 @@ Layer::Activated(bool active)
BPoint BPoint
Layer::BoundsOrigin() const Layer::BoundsOrigin() const
{ {
BPoint origin(0, 0); BPoint origin(fDrawState->Origin());
float scale = Scale(); float scale = Scale();
DrawState* layerData = fDrawState; // TODO: Figure this out, BoundsOrigin()
do { // is used for BView::Bounds(), but I think
origin += layerData->Origin(); // that the scale has nothing to do with it
} while ((layerData = layerData->PreviousState()) != NULL); // "local coordinate system origin" does have
// something to do with scale.
origin.x *= scale; origin.x *= scale;
origin.y *= scale; origin.y *= scale;
@@ -1473,7 +1474,6 @@ void Layer::do_MoveBy(float dx, float dy)
if (dx == 0.0f && dy == 0.0f) if (dx == 0.0f && dy == 0.0f)
return; return;
// fFrame.Set(fFrame.left+dx, fFrame.top+dy, fFrame.right+dx, fFrame.bottom+dy);
fFrame.OffsetBy(dx, dy); fFrame.OffsetBy(dx, dy);
// call hook function // call hook function
@@ -1552,8 +1552,6 @@ Layer::do_ScrollBy(float dx, float dy)
if (dx != 0.0f || dy != 0.0f) if (dx != 0.0f || dy != 0.0f)
ScrolledByHook(dx, dy); ScrolledByHook(dx, dy);
SendViewCoordUpdateMsg();
} }
void void
+1 -2
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 // our offset in the parent -> will be originX and originY in BView
fLink.Attach<float>(fCurrentLayer->fFrame.left); fLink.Attach<float>(fCurrentLayer->fFrame.left);
fLink.Attach<float>(fCurrentLayer->fFrame.top); fLink.Attach<float>(fCurrentLayer->fFrame.top);
// convert frame to bounds fLink.Attach<BRect>(fCurrentLayer->Bounds());
fLink.Attach<BRect>(fCurrentLayer->fFrame.OffsetToCopy(fCurrentLayer->BoundsOrigin()));
fLink.Flush(); fLink.Flush();
break; break;
} }