* Renamed Layer::GetWantedRegion() to GetOnScreenRegion().
* minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+36
-31
@@ -482,7 +482,7 @@ Layer::Show(bool invalidate)
|
|||||||
if (invalidate) {
|
if (invalidate) {
|
||||||
// compute the region this layer wants for itself
|
// compute the region this layer wants for itself
|
||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
GetWantedRegion(invalid);
|
GetOnScreenRegion(invalid);
|
||||||
if (invalid.CountRects() > 0) {
|
if (invalid.CountRects() > 0) {
|
||||||
fParent->MarkForRebuild(invalid);
|
fParent->MarkForRebuild(invalid);
|
||||||
GetRootLayer()->MarkForRedraw(invalid);
|
GetRootLayer()->MarkForRedraw(invalid);
|
||||||
@@ -598,7 +598,7 @@ Layer::MoveBy(float x, float y)
|
|||||||
|
|
||||||
// we'll invalidate the old position and the new, maxmial one.
|
// we'll invalidate the old position and the new, maxmial one.
|
||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
GetWantedRegion(invalid);
|
GetOnScreenRegion(invalid);
|
||||||
invalid.Include(&fFullVisible2);
|
invalid.Include(&fFullVisible2);
|
||||||
|
|
||||||
fParent->MarkForRebuild(invalid);
|
fParent->MarkForRebuild(invalid);
|
||||||
@@ -673,7 +673,7 @@ Layer::ResizeBy(float x, float y)
|
|||||||
|
|
||||||
// we'll invalidate the old area and the new, maxmial one.
|
// we'll invalidate the old area and the new, maxmial one.
|
||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
GetWantedRegion(invalid);
|
GetOnScreenRegion(invalid);
|
||||||
invalid.Include(&fFullVisible2);
|
invalid.Include(&fFullVisible2);
|
||||||
|
|
||||||
fParent->MarkForRebuild(invalid);
|
fParent->MarkForRebuild(invalid);
|
||||||
@@ -1173,6 +1173,7 @@ Layer::do_Hide()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::do_Show()
|
Layer::do_Show()
|
||||||
{
|
{
|
||||||
@@ -1181,7 +1182,7 @@ Layer::do_Show()
|
|||||||
if (fParent && !fParent->IsHidden() && GetRootLayer()) {
|
if (fParent && !fParent->IsHidden() && GetRootLayer()) {
|
||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
|
|
||||||
GetWantedRegion(invalid);
|
GetOnScreenRegion(invalid);
|
||||||
|
|
||||||
if (invalid.CountRects() > 0) {
|
if (invalid.CountRects() > 0) {
|
||||||
fParent->MarkForRebuild(invalid);
|
fParent->MarkForRebuild(invalid);
|
||||||
@@ -1193,11 +1194,12 @@ Layer::do_Show()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
|
void
|
||||||
Layer::_ResizeLayerFrameBy(float x, float y)
|
Layer::_ResizeLayerFrameBy(float x, float y)
|
||||||
{
|
{
|
||||||
uint16 rm = fResizeMode & 0x0000FFFF;
|
uint16 rm = fResizeMode & 0x0000FFFF;
|
||||||
BRect newFrame = fFrame;
|
BRect newFrame = fFrame;
|
||||||
|
|
||||||
if ((rm & 0x0F00U) == _VIEW_LEFT_ << 8)
|
if ((rm & 0x0F00U) == _VIEW_LEFT_ << 8)
|
||||||
newFrame.left += 0.0f;
|
newFrame.left += 0.0f;
|
||||||
@@ -1254,12 +1256,12 @@ Layer::_ResizeLayerFrameBy(float x, float y)
|
|||||||
// TODO: the above code is CORRECT!!!
|
// TODO: the above code is CORRECT!!!
|
||||||
// It's commented because BView::FrameResized()/Moved() be called twice a given view. FIX THIS!
|
// It's commented because BView::FrameResized()/Moved() be called twice a given view. FIX THIS!
|
||||||
if (newFrame != fFrame) {
|
if (newFrame != fFrame) {
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
|
|
||||||
dx = newFrame.Width() - fFrame.Width();
|
dx = newFrame.Width() - fFrame.Width();
|
||||||
dy = newFrame.Height() - fFrame.Height();
|
dy = newFrame.Height() - fFrame.Height();
|
||||||
|
|
||||||
fFrame = newFrame;
|
fFrame = newFrame;
|
||||||
|
|
||||||
if (dx != 0.0f || dy != 0.0f) {
|
if (dx != 0.0f || dy != 0.0f) {
|
||||||
// call hook function
|
// call hook function
|
||||||
@@ -1272,7 +1274,8 @@ Layer::_ResizeLayerFrameBy(float x, float y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
|
void
|
||||||
Layer::_RezizeLayerRedrawMore(BRegion ®, float dx, float dy)
|
Layer::_RezizeLayerRedrawMore(BRegion ®, float dx, float dy)
|
||||||
{
|
{
|
||||||
if (dx == 0 && dy == 0)
|
if (dx == 0 && dy == 0)
|
||||||
@@ -1311,19 +1314,17 @@ Layer::_RezizeLayerRedrawMore(BRegion ®, float dx, float dy)
|
|||||||
|
|
||||||
// above, OR this:
|
// above, OR this:
|
||||||
// reg.Include(&child->fFullVisible2);
|
// reg.Include(&child->fFullVisible2);
|
||||||
}
|
} else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0)
|
||||||
else
|
|| ((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0)
|
||||||
if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) ||
|
|| ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)
|
||||||
((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) ||
|
|| ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0)) {
|
||||||
((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)||
|
|
||||||
((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0))
|
|
||||||
{
|
|
||||||
reg.Include(&child->fFullVisible2);
|
reg.Include(&child->fFullVisible2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
|
void
|
||||||
Layer::_ResizeLayerFullUpdateOnResize(BRegion ®, float dx, float dy)
|
Layer::_ResizeLayerFullUpdateOnResize(BRegion ®, float dx, float dy)
|
||||||
{
|
{
|
||||||
if (dx == 0 && dy == 0)
|
if (dx == 0 && dy == 0)
|
||||||
@@ -1343,17 +1344,21 @@ Layer::_ResizeLayerFullUpdateOnResize(BRegion ®, float dx, float dy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Returns the region of the layer that is within the screen region
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
Layer::GetWantedRegion(BRegion ®)
|
Layer::GetOnScreenRegion(BRegion ®ion)
|
||||||
{
|
{
|
||||||
// 1) set to frame in screen coords
|
// 1) set to frame in screen coords
|
||||||
BRect screenFrame(Bounds());
|
BRect frame(Bounds());
|
||||||
ConvertToScreen(&screenFrame);
|
ConvertToScreen(&frame);
|
||||||
reg.Set(screenFrame);
|
region.Set(frame);
|
||||||
|
|
||||||
// 2) intersect with screen region
|
// 2) intersect with screen region
|
||||||
BRegion screenReg(GetRootLayer()->Bounds());
|
BRegion screenRegion(GetRootLayer()->Bounds());
|
||||||
reg.IntersectWith(&screenReg);
|
region.IntersectWith(&screenRegion);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// 3) impose user constrained regions
|
// 3) impose user constrained regions
|
||||||
@@ -1366,10 +1371,10 @@ Layer::GetWantedRegion(BRegion ®)
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::_RebuildVisibleRegions( const BRegion &invalid,
|
Layer::_RebuildVisibleRegions(const BRegion &invalid,
|
||||||
const BRegion &parentLocalVisible,
|
const BRegion &parentLocalVisible, const Layer *startFrom)
|
||||||
const Layer *startFrom)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// no point in continuing if this layer is hidden.
|
// no point in continuing if this layer is hidden.
|
||||||
@@ -1385,7 +1390,7 @@ Layer::_RebuildVisibleRegions( const BRegion &invalid,
|
|||||||
|
|
||||||
// intersect maximum wanted region with the invalid region
|
// intersect maximum wanted region with the invalid region
|
||||||
BRegion common;
|
BRegion common;
|
||||||
GetWantedRegion(common);
|
GetOnScreenRegion(common);
|
||||||
common.IntersectWith(&invalid);
|
common.IntersectWith(&invalid);
|
||||||
|
|
||||||
// if the resulted region is not valid, this layer is not in the catchment area
|
// if the resulted region is not valid, this layer is not in the catchment area
|
||||||
@@ -1437,7 +1442,7 @@ Layer::_RebuildVisibleRegions( const BRegion &invalid,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BRegion common;
|
BRegion common;
|
||||||
GetWantedRegion(common);
|
GetOnScreenRegion(common);
|
||||||
|
|
||||||
// see how much you can take
|
// see how much you can take
|
||||||
common.IntersectWith(&parentLocalVisible);
|
common.IntersectWith(&parentLocalVisible);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ class Layer {
|
|||||||
inline const BRegion& FullVisible() const { return fFullVisible2; }
|
inline const BRegion& FullVisible() const { return fFullVisible2; }
|
||||||
inline const BRegion& DrawingRegion() const { return fDrawingRegion; }
|
inline const BRegion& DrawingRegion() const { return fDrawingRegion; }
|
||||||
|
|
||||||
virtual void GetWantedRegion(BRegion& reg);
|
virtual void GetOnScreenRegion(BRegion& region);
|
||||||
|
|
||||||
void MarkForRebuild(const BRegion &dirty);
|
void MarkForRebuild(const BRegion &dirty);
|
||||||
void TriggerRebuild();
|
void TriggerRebuild();
|
||||||
|
|||||||
@@ -872,7 +872,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
|
|
||||||
// invalidate the maximum area which this layer/window can occupy.
|
// invalidate the maximum area which this layer/window can occupy.
|
||||||
layer->GetWantedRegion(invalid);
|
layer->GetOnScreenRegion(invalid);
|
||||||
|
|
||||||
MarkForRebuild(invalid);
|
MarkForRebuild(invalid);
|
||||||
MarkForRedraw(invalid);
|
MarkForRedraw(invalid);
|
||||||
@@ -893,7 +893,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
BRegion invalid;
|
BRegion invalid;
|
||||||
|
|
||||||
// start by invalidating the maximum area which this layer/window can occupy.
|
// start by invalidating the maximum area which this layer/window can occupy.
|
||||||
layer->GetWantedRegion(invalid);
|
layer->GetOnScreenRegion(invalid);
|
||||||
|
|
||||||
// no reason to invalidate what's currently visible.
|
// no reason to invalidate what's currently visible.
|
||||||
invalid.Exclude(&layer->FullVisible());
|
invalid.Exclude(&layer->FullVisible());
|
||||||
@@ -1398,7 +1398,7 @@ RootLayer::ClearNotifyLayer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LayerRemoved
|
|
||||||
void
|
void
|
||||||
RootLayer::LayerRemoved(Layer* layer)
|
RootLayer::LayerRemoved(Layer* layer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
if (myRootLayer && !newLayer->IsHidden() && parent) {
|
if (myRootLayer && !newLayer->IsHidden() && parent) {
|
||||||
BRegion invalidRegion;
|
BRegion invalidRegion;
|
||||||
newLayer->GetWantedRegion(invalidRegion);
|
newLayer->GetOnScreenRegion(invalidRegion);
|
||||||
parent->MarkForRebuild(invalidRegion);
|
parent->MarkForRebuild(invalidRegion);
|
||||||
parent->TriggerRebuild();
|
parent->TriggerRebuild();
|
||||||
if (newLayer->VisibleRegion().Frame().IsValid()) {
|
if (newLayer->VisibleRegion().Frame().IsValid()) {
|
||||||
@@ -1058,7 +1058,7 @@ if (myRootLayer)
|
|||||||
|
|
||||||
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) {
|
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) {
|
||||||
BRegion invalidRegion;
|
BRegion invalidRegion;
|
||||||
fCurrentLayer->GetWantedRegion(invalidRegion);
|
fCurrentLayer->GetOnScreenRegion(invalidRegion);
|
||||||
|
|
||||||
// TODO: this is broken! a smaller area may be invalidated!
|
// TODO: this is broken! a smaller area may be invalidated!
|
||||||
|
|
||||||
|
|||||||
@@ -798,20 +798,19 @@ WinBorder::_ReserveRegions(BRegion ®)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WinBorder::GetWantedRegion(BRegion ®)
|
WinBorder::GetOnScreenRegion(BRegion& region)
|
||||||
{
|
{
|
||||||
if (fRebuildDecRegion)
|
if (fRebuildDecRegion)
|
||||||
set_decorator_region(Bounds());
|
set_decorator_region(Bounds());
|
||||||
|
|
||||||
BRect screenFrame(Bounds());
|
BRect frame(Bounds());
|
||||||
ConvertToScreen(&screenFrame);
|
ConvertToScreen(&frame);
|
||||||
reg.Set(screenFrame);
|
region.Set(frame);
|
||||||
|
|
||||||
reg.Include(&fDecRegion);
|
region.Include(&fDecRegion);
|
||||||
|
|
||||||
BRegion screenReg(GetRootLayer()->Bounds());
|
BRegion screenRegion(GetRootLayer()->Bounds());
|
||||||
|
region.IntersectWith(&screenRegion);
|
||||||
reg.IntersectWith(&screenReg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class WinBorder : public Layer {
|
|||||||
virtual bool IsOffscreenWindow() const
|
virtual bool IsOffscreenWindow() const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
virtual void GetWantedRegion(BRegion ®);
|
virtual void GetOnScreenRegion(BRegion& region);
|
||||||
|
|
||||||
void UpdateStart();
|
void UpdateStart();
|
||||||
void UpdateEnd();
|
void UpdateEnd();
|
||||||
|
|||||||
Reference in New Issue
Block a user