Got scrolling to work properly
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ba2286a9a9
commit
fd5fe00cb1
Binary file not shown.
@ -281,8 +281,7 @@ void Layer::MoveBy(float dx, float dy)
|
|||||||
|
|
||||||
// offset back and instruct the HW to do the actual copying.
|
// offset back and instruct the HW to do the actual copying.
|
||||||
oldFullVisible.OffsetBy(-dx, -dy);
|
oldFullVisible.OffsetBy(-dx, -dy);
|
||||||
// TODO: HACK this!
|
GetRootLayer()->CopyRegion(&oldFullVisible, dx, dy);
|
||||||
// GetDisplayDriver()->CopyRegion(&oldFullVisible, dx, dy);
|
|
||||||
|
|
||||||
// add redrawReg to our RootLayer's redraw region.
|
// add redrawReg to our RootLayer's redraw region.
|
||||||
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||||
@ -313,16 +312,14 @@ void Layer::ScrollBy(float dx, float dy)
|
|||||||
// offset old region so that we can start comparing.
|
// offset old region so that we can start comparing.
|
||||||
invalid.OffsetBy(dx, dy);
|
invalid.OffsetBy(dx, dy);
|
||||||
|
|
||||||
// no need to redraw common regions. redraw only what's needed.
|
|
||||||
redrawReg.Exclude(&invalid);
|
|
||||||
|
|
||||||
// compute the common region. we'll use HW acc to copy this to the new location.
|
// compute the common region. we'll use HW acc to copy this to the new location.
|
||||||
invalid.IntersectWith(&fFullVisible);
|
invalid.IntersectWith(&fFullVisible);
|
||||||
|
GetRootLayer()->CopyRegion(&invalid, -dx, -dy);
|
||||||
|
|
||||||
// offset back and instruct the driver to do the actual copying.
|
// common region goes back to its original location. then, by excluding
|
||||||
|
// it from curent fullVisible we'll obtain the region that needs to be redrawn.
|
||||||
invalid.OffsetBy(-dx, -dy);
|
invalid.OffsetBy(-dx, -dy);
|
||||||
// TODO: HACK this!
|
redrawReg.Exclude(&invalid);
|
||||||
// GetDisplayDriver()->CopyRegion(&invalid, dx, dy);
|
|
||||||
|
|
||||||
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||||
GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||||
@ -337,7 +334,6 @@ void Layer::set_user_regions(BRegion ®)
|
|||||||
// OPT: maybe we should have all these cached in a 'fFull' member
|
// OPT: maybe we should have all these cached in a 'fFull' member
|
||||||
|
|
||||||
// 1) set to frame in screen coords
|
// 1) set to frame in screen coords
|
||||||
// BRect screenFrame(fFrame);
|
|
||||||
BRect screenFrame(Bounds());
|
BRect screenFrame(Bounds());
|
||||||
ConvertToScreen2(&screenFrame);
|
ConvertToScreen2(&screenFrame);
|
||||||
reg.Set(screenFrame);
|
reg.Set(screenFrame);
|
||||||
|
@ -20,8 +20,8 @@ MyView::MyView(BRect frame, const char *name, uint32 resizingMode, uint32 flags)
|
|||||||
topLayer = new Layer(Bounds(), "topLayer", B_FOLLOW_ALL, col);
|
topLayer = new Layer(Bounds(), "topLayer", B_FOLLOW_ALL, col);
|
||||||
topLayer->SetRootLayer(this);
|
topLayer->SetRootLayer(this);
|
||||||
|
|
||||||
// topLayer->RebuildVisibleRegions(BRegion(Bounds()), NULL);
|
|
||||||
topLayer->rebuild_visible_regions(BRegion(Bounds()), BRegion(Bounds()), NULL);
|
topLayer->rebuild_visible_regions(BRegion(Bounds()), BRegion(Bounds()), NULL);
|
||||||
|
fRedrawReg.Set(Bounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
MyView::~MyView()
|
MyView::~MyView()
|
||||||
@ -48,9 +48,20 @@ Layer* MyView::FindLayer(Layer *lay, const char *bytes) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyView::CopyRegion(BRegion *reg, float dx, float dy)
|
||||||
|
{
|
||||||
|
wind->Lock();
|
||||||
|
// ConstrainClippingRegion(&r);
|
||||||
|
// CopyBits(Bounds(), Bounds().OffsetByCopy(dx, dy));
|
||||||
|
// TODO: properly do that!
|
||||||
|
// LAME, I know!
|
||||||
|
CopyBits(reg->Frame(), reg->Frame().OffsetByCopy(dx, dy));
|
||||||
|
// ConstrainClippingRegion(NULL);
|
||||||
|
wind->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void MyView::RequestRedraw()
|
void MyView::RequestRedraw()
|
||||||
{
|
{
|
||||||
// TODO: implement
|
|
||||||
wind->Lock();
|
wind->Lock();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
wind->Unlock();
|
wind->Unlock();
|
||||||
@ -58,14 +69,19 @@ void MyView::RequestRedraw()
|
|||||||
|
|
||||||
void MyView::Draw(BRect area)
|
void MyView::Draw(BRect area)
|
||||||
{
|
{
|
||||||
|
ConstrainClippingRegion(&fRedrawReg);
|
||||||
|
PushState();
|
||||||
DrawSubTree(topLayer);
|
DrawSubTree(topLayer);
|
||||||
|
PopState();
|
||||||
|
ConstrainClippingRegion(NULL);
|
||||||
|
fRedrawReg.MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyView::DrawSubTree(Layer* lay)
|
void MyView::DrawSubTree(Layer* lay)
|
||||||
{
|
{
|
||||||
printf("======== %s =======\n", lay->Name());
|
//printf("======== %s =======\n", lay->Name());
|
||||||
lay->Visible()->PrintToStream();
|
// lay->Visible()->PrintToStream();
|
||||||
lay->FullVisible()->PrintToStream();
|
// lay->FullVisible()->PrintToStream();
|
||||||
Layer *child = lay->VirtualBottomChild();
|
Layer *child = lay->VirtualBottomChild();
|
||||||
while(child)
|
while(child)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ public:
|
|||||||
|
|
||||||
virtual void Draw(BRect area);
|
virtual void Draw(BRect area);
|
||||||
|
|
||||||
|
void CopyRegion(BRegion *reg, float dx, float dy);
|
||||||
void RequestRedraw();
|
void RequestRedraw();
|
||||||
|
|
||||||
Layer* FindLayer(Layer *lay, const char *bytes) const;
|
Layer* FindLayer(Layer *lay, const char *bytes) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user