Some cleanup. Removed do_Hide, do_Show and do_CopyBits
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15034 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+53
-103
@@ -733,7 +733,7 @@ Layer::ScrollBy(float x, float y)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// must lock, even if we change frame/origin coordinates
|
// must lock, even if we change frame/origin coordinates
|
||||||
if (fParent && !IsHidden() && GetRootLayer() && GetRootLayer()->Lock()) {
|
if (!IsHidden() && GetRootLayer() && GetRootLayer()->Lock()) {
|
||||||
fDrawState->OffsetOrigin(BPoint(x, y));
|
fDrawState->OffsetOrigin(BPoint(x, y));
|
||||||
|
|
||||||
// set the region to be invalidated.
|
// set the region to be invalidated.
|
||||||
@@ -774,6 +774,58 @@ Layer::ScrollBy(float x, float y)
|
|||||||
// SendViewCoordUpdateMsg();
|
// SendViewCoordUpdateMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Layer::CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset)
|
||||||
|
{
|
||||||
|
// NOTE: The correct behaviour is this:
|
||||||
|
// * The region that is copied is the
|
||||||
|
// src rectangle, no matter if it fits
|
||||||
|
// into the dst rectangle. It is copied
|
||||||
|
// by the offset dst.LeftTop() - src.LeftTop()
|
||||||
|
// * The dst rectangle is used for invalidation:
|
||||||
|
// Any area in the dst rectangle that could
|
||||||
|
// not be copied from src (because either the
|
||||||
|
// src rectangle was not big enough, or because there
|
||||||
|
// were parts cut off by the current layer clipping),
|
||||||
|
// are triggering BView::Draw() to be called
|
||||||
|
// and for these parts only.
|
||||||
|
|
||||||
|
if (!GetRootLayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsHidden() && GetRootLayer()->Lock()) {
|
||||||
|
// the region that is going to be copied
|
||||||
|
BRegion copyRegion(src);
|
||||||
|
|
||||||
|
// apply the current clipping of the layer
|
||||||
|
copyRegion.IntersectWith(&fVisible);
|
||||||
|
|
||||||
|
// offset the region to the destination
|
||||||
|
// and apply the current clipping there as well
|
||||||
|
copyRegion.OffsetBy(xOffset, yOffset);
|
||||||
|
copyRegion.IntersectWith(&fVisible);
|
||||||
|
|
||||||
|
// the region at the destination that needs invalidation
|
||||||
|
BRegion redrawReg(dst);
|
||||||
|
// exclude the region drawn by the copy operation
|
||||||
|
// TODO: quick fix for our scrolling problem. FIX THIS!
|
||||||
|
// redrawReg.Exclude(©Region);
|
||||||
|
// apply the current clipping as well
|
||||||
|
redrawReg.IntersectWith(&fVisible);
|
||||||
|
|
||||||
|
// move the region back for the actual operation
|
||||||
|
copyRegion.OffsetBy(-xOffset, -yOffset);
|
||||||
|
|
||||||
|
GetDrawingEngine()->CopyRegion(©Region, xOffset, yOffset);
|
||||||
|
|
||||||
|
// trigger the redraw
|
||||||
|
GetRootLayer()->MarkForRedraw(redrawReg);
|
||||||
|
GetRootLayer()->TriggerRedraw();
|
||||||
|
|
||||||
|
GetRootLayer()->Unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::MouseDown(const BMessage *msg)
|
Layer::MouseDown(const BMessage *msg)
|
||||||
{
|
{
|
||||||
@@ -898,64 +950,6 @@ Layer::SetOverlayBitmap(const ServerBitmap* bitmap)
|
|||||||
fOverlayBitmap = bitmap;
|
fOverlayBitmap = bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Layer::CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset) {
|
|
||||||
|
|
||||||
GetRootLayer()->Lock();
|
|
||||||
do_CopyBits(src, dst, xOffset, yOffset);
|
|
||||||
GetRootLayer()->Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Layer::do_CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset) {
|
|
||||||
// NOTE: The correct behaviour is this:
|
|
||||||
// * The region that is copied is the
|
|
||||||
// src rectangle, no matter if it fits
|
|
||||||
// into the dst rectangle. It is copied
|
|
||||||
// by the offset dst.LeftTop() - src.LeftTop()
|
|
||||||
// * The dst rectangle is used for invalidation:
|
|
||||||
// Any area in the dst rectangle that could
|
|
||||||
// not be copied from src (because either the
|
|
||||||
// src rectangle was not big enough, or because there
|
|
||||||
// were parts cut off by the current layer clipping),
|
|
||||||
// are triggering BView::Draw() to be called
|
|
||||||
// and for these parts only.
|
|
||||||
|
|
||||||
// TODO: having moved this into Layer broke
|
|
||||||
// offscreen windows (bitmaps)
|
|
||||||
// -> move back into ServerWindow...
|
|
||||||
if (!GetRootLayer())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// the region that is going to be copied
|
|
||||||
BRegion copyRegion(src);
|
|
||||||
// apply the current clipping of the layer
|
|
||||||
|
|
||||||
copyRegion.IntersectWith(&fVisible);
|
|
||||||
|
|
||||||
// offset the region to the destination
|
|
||||||
// and apply the current clipping there as well
|
|
||||||
copyRegion.OffsetBy(xOffset, yOffset);
|
|
||||||
copyRegion.IntersectWith(&fVisible);
|
|
||||||
|
|
||||||
// the region at the destination that needs invalidation
|
|
||||||
BRegion redrawReg(dst);
|
|
||||||
// exclude the region drawn by the copy operation
|
|
||||||
// TODO: quick fix for our scrolling problem. FIX THIS!
|
|
||||||
// redrawReg.Exclude(©Region);
|
|
||||||
// apply the current clipping as well
|
|
||||||
redrawReg.IntersectWith(&fVisible);
|
|
||||||
|
|
||||||
// move the region back for the actual operation
|
|
||||||
copyRegion.OffsetBy(-xOffset, -yOffset);
|
|
||||||
|
|
||||||
GetDrawingEngine()->CopyRegion(©Region, xOffset, yOffset);
|
|
||||||
|
|
||||||
// trigger the redraw
|
|
||||||
GetRootLayer()->MarkForRedraw(redrawReg);
|
|
||||||
GetRootLayer()->TriggerRedraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::MovedByHook(float dx, float dy)
|
Layer::MovedByHook(float dx, float dy)
|
||||||
{
|
{
|
||||||
@@ -1106,50 +1100,6 @@ Layer::ConvertFromScreen(BRegion* reg) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Layer::do_Hide()
|
|
||||||
{
|
|
||||||
fHidden = true;
|
|
||||||
|
|
||||||
if (fParent && !fParent->IsHidden() && GetRootLayer()) {
|
|
||||||
// save fullVisible so we know what to invalidate
|
|
||||||
BRegion invalid(fFullVisible);
|
|
||||||
|
|
||||||
_ClearVisibleRegions();
|
|
||||||
|
|
||||||
if (invalid.CountRects() > 0) {
|
|
||||||
fParent->MarkForRebuild(invalid);
|
|
||||||
GetRootLayer()->MarkForRedraw(invalid);
|
|
||||||
|
|
||||||
fParent->TriggerRebuild();
|
|
||||||
GetRootLayer()->TriggerRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Layer::do_Show()
|
|
||||||
{
|
|
||||||
fHidden = false;
|
|
||||||
|
|
||||||
if (fParent && !fParent->IsHidden() && GetRootLayer()) {
|
|
||||||
BRegion invalid;
|
|
||||||
|
|
||||||
GetOnScreenRegion(invalid);
|
|
||||||
|
|
||||||
if (invalid.CountRects() > 0) {
|
|
||||||
fParent->MarkForRebuild(invalid);
|
|
||||||
GetRootLayer()->MarkForRedraw(invalid);
|
|
||||||
|
|
||||||
fParent->TriggerRebuild();
|
|
||||||
GetRootLayer()->TriggerRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::_ResizeLayerFrameBy(float x, float y)
|
Layer::_ResizeLayerFrameBy(float x, float y)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -208,11 +208,6 @@ class Layer {
|
|||||||
friend class WinBorder;
|
friend class WinBorder;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
|
|
||||||
void do_Hide();
|
|
||||||
void do_Show();
|
|
||||||
void do_CopyBits(BRect& src, BRect& dst,
|
|
||||||
int32 xOffset, int32 yOffset);
|
|
||||||
|
|
||||||
// private clipping stuff
|
// private clipping stuff
|
||||||
virtual void _ReserveRegions(BRegion ®);
|
virtual void _ReserveRegions(BRegion ®);
|
||||||
void _RebuildVisibleRegions( const BRegion &invalid,
|
void _RebuildVisibleRegions( const BRegion &invalid,
|
||||||
|
|||||||
Reference in New Issue
Block a user