Cleanup.
* removed old Convert{To|From}{Parent|Top} methods. They were replaced by
Convert{To|From}{Parent|Screen}(type *data)
* removed some unused methods from Layer class.
* re-aranged Layer's class declaration - grouped methods
* made all Layer's members private.
* renamed a few private methods from method_name _MethodName
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14778 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+59
-272
@@ -39,23 +39,24 @@
|
|||||||
# define STRACE(x) ;
|
# define STRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DEBUG_LAYER_REBUILD
|
|
||||||
#ifdef DEBUG_LAYER_REBUILD
|
|
||||||
# define RBTRACE(x) printf x
|
|
||||||
#else
|
|
||||||
# define RBTRACE(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
Layer::Layer(BRect frame, const char* name, int32 token,
|
Layer::Layer(BRect frame, const char* name, int32 token,
|
||||||
uint32 resize, uint32 flags, DrawingEngine* driver)
|
uint32 resize, uint32 flags, DrawingEngine* driver)
|
||||||
:
|
:
|
||||||
fFrame(frame), // in parent coordinates
|
fName(name),
|
||||||
|
fFrame(frame),
|
||||||
// fBoundsLeftTop(0.0, 0.0),
|
// fBoundsLeftTop(0.0, 0.0),
|
||||||
|
|
||||||
// Layer does not start out as a part of the tree
|
fVisible2(),
|
||||||
|
fFullVisible2(),
|
||||||
|
fDirtyForRebuild(),
|
||||||
|
|
||||||
|
fDriver(driver),
|
||||||
|
fRootLayer(NULL),
|
||||||
|
fServerWin(NULL),
|
||||||
fOwner(NULL),
|
fOwner(NULL),
|
||||||
|
|
||||||
|
fDrawState(new DrawState),
|
||||||
|
|
||||||
fParent(NULL),
|
fParent(NULL),
|
||||||
fPreviousSibling(NULL),
|
fPreviousSibling(NULL),
|
||||||
fNextSibling(NULL),
|
fNextSibling(NULL),
|
||||||
@@ -64,31 +65,17 @@ Layer::Layer(BRect frame, const char* name, int32 token,
|
|||||||
|
|
||||||
fCurrent(NULL),
|
fCurrent(NULL),
|
||||||
|
|
||||||
// all regions (fVisible, fFullVisible, fFull) start empty
|
|
||||||
fVisible2(),
|
|
||||||
fFullVisible2(),
|
|
||||||
fDirtyForRebuild(),
|
|
||||||
fClipReg(&fVisible2),
|
|
||||||
|
|
||||||
fServerWin(NULL),
|
|
||||||
fName(name),
|
|
||||||
fViewToken(token),
|
fViewToken(token),
|
||||||
|
|
||||||
fFlags(flags),
|
fFlags(flags),
|
||||||
|
fAdFlags(0),
|
||||||
fResizeMode(resize),
|
fResizeMode(resize),
|
||||||
fEventMask(0UL),
|
fEventMask(0UL),
|
||||||
fEventOptions(0UL),
|
fEventOptions(0UL),
|
||||||
|
|
||||||
fHidden(false),
|
fHidden(false),
|
||||||
fIsTopLayer(false),
|
fIsTopLayer(false),
|
||||||
|
|
||||||
fAdFlags(0),
|
|
||||||
|
|
||||||
fDriver(driver),
|
|
||||||
fDrawState(new DrawState),
|
|
||||||
|
|
||||||
fRootLayer(NULL),
|
|
||||||
|
|
||||||
fViewColor(255, 255, 255, 255),
|
fViewColor(255, 255, 255, 255),
|
||||||
|
|
||||||
fBackgroundBitmap(NULL),
|
fBackgroundBitmap(NULL),
|
||||||
fOverlayBitmap(NULL)
|
fOverlayBitmap(NULL)
|
||||||
{
|
{
|
||||||
@@ -254,7 +241,7 @@ Layer::RemoveChild(Layer *layer)
|
|||||||
|
|
||||||
layer->fPreviousSibling = NULL;
|
layer->fPreviousSibling = NULL;
|
||||||
layer->fNextSibling = NULL;
|
layer->fNextSibling = NULL;
|
||||||
layer->clear_visible_regions();
|
layer->_ClearVisibleRegions();
|
||||||
|
|
||||||
// 2) Iterate over all of the removed-layer's descendants and unset the
|
// 2) Iterate over all of the removed-layer's descendants and unset the
|
||||||
// root layer, server window, and all redraw-related regions
|
// root layer, server window, and all redraw-related regions
|
||||||
@@ -740,107 +727,6 @@ Layer::Scale() const
|
|||||||
return CurrentState()->Scale();
|
return CurrentState()->Scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Converts the passed point to parent coordinates
|
|
||||||
BPoint
|
|
||||||
Layer::ConvertToParent(BPoint pt)
|
|
||||||
{
|
|
||||||
ConvertToParent2(&pt);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed rectangle to parent coordinates
|
|
||||||
BRect
|
|
||||||
Layer::ConvertToParent(BRect rect)
|
|
||||||
{
|
|
||||||
ConvertToParent2(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed region to parent coordinates
|
|
||||||
BRegion
|
|
||||||
Layer::ConvertToParent(BRegion* reg)
|
|
||||||
{
|
|
||||||
BRegion newReg(*reg);
|
|
||||||
ConvertToParent2(&newReg);
|
|
||||||
return newReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed point from parent coordinates
|
|
||||||
BPoint
|
|
||||||
Layer::ConvertFromParent(BPoint pt)
|
|
||||||
{
|
|
||||||
ConvertFromParent2(&pt);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed rectangle from parent coordinates
|
|
||||||
BRect
|
|
||||||
Layer::ConvertFromParent(BRect rect)
|
|
||||||
{
|
|
||||||
ConvertFromParent2(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed region from parent coordinates
|
|
||||||
BRegion
|
|
||||||
Layer::ConvertFromParent(BRegion *reg)
|
|
||||||
{
|
|
||||||
BRegion newReg(*reg);
|
|
||||||
ConvertFromParent2(&newReg);
|
|
||||||
return newReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConvertToTop
|
|
||||||
BPoint
|
|
||||||
Layer::ConvertToTop(BPoint pt)
|
|
||||||
{
|
|
||||||
ConvertToScreen2(&pt);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed rectangle to screen coordinates
|
|
||||||
BRect
|
|
||||||
Layer::ConvertToTop(BRect rect)
|
|
||||||
{
|
|
||||||
ConvertToScreen2(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed region to screen coordinates
|
|
||||||
BRegion
|
|
||||||
Layer::ConvertToTop(BRegion *reg)
|
|
||||||
{
|
|
||||||
BRegion newReg(*reg);
|
|
||||||
ConvertToScreen2(&newReg);
|
|
||||||
return newReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConvertFromTop
|
|
||||||
BPoint
|
|
||||||
Layer::ConvertFromTop(BPoint pt)
|
|
||||||
{
|
|
||||||
ConvertFromScreen2(&pt);
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed rectangle from screen coordinates
|
|
||||||
BRect
|
|
||||||
Layer::ConvertFromTop(BRect rect)
|
|
||||||
{
|
|
||||||
ConvertFromScreen2(&rect);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Converts the passed region from screen coordinates
|
|
||||||
BRegion
|
|
||||||
Layer::ConvertFromTop(BRegion *reg)
|
|
||||||
{
|
|
||||||
BRegion newReg(*reg);
|
|
||||||
ConvertFromScreen2(&newReg);
|
|
||||||
return newReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Recursively deletes all children of the calling layer
|
//! Recursively deletes all children of the calling layer
|
||||||
void
|
void
|
||||||
Layer::PruneTree(void)
|
Layer::PruneTree(void)
|
||||||
@@ -865,105 +751,6 @@ Layer::PruneTree(void)
|
|||||||
// Man, this thing is short. Elegant, ain't it? :P
|
// Man, this thing is short. Elegant, ain't it? :P
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Prints information about the layer's current state
|
|
||||||
void
|
|
||||||
Layer::PrintToStream()
|
|
||||||
{
|
|
||||||
printf("\n *** Layer %s:\n", Name());
|
|
||||||
printf("\t Parent: %s", fParent ? fParent->Name() : "<no parent>");
|
|
||||||
|
|
||||||
printf("\t us: %s\t ls: %s\n",
|
|
||||||
fPreviousSibling ? fPreviousSibling->Name() : "<none>",
|
|
||||||
fNextSibling ? fNextSibling->Name() : "<none>");
|
|
||||||
|
|
||||||
printf("\t topChild: %s\t bottomChild: %s\n",
|
|
||||||
fFirstChild ? fFirstChild->Name() : "<none>",
|
|
||||||
fLastChild ? fLastChild->Name() : "<none>");
|
|
||||||
|
|
||||||
printf("Frame: (%f, %f, %f, %f)\n", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom);
|
|
||||||
printf("LocalOrigin: (%f, %f)\n", BoundsOrigin().x, BoundsOrigin().y);
|
|
||||||
printf("Token: %ld\n", fViewToken);
|
|
||||||
printf("Hidden - direct: %s ", fHidden?"true":"false");
|
|
||||||
printf("Hidden - indirect: %s\n", IsHidden()?"true":"false");
|
|
||||||
printf("ResizingMode: %lx ", fResizeMode);
|
|
||||||
printf("Flags: %lx\n", fFlags);
|
|
||||||
|
|
||||||
if (fDrawState)
|
|
||||||
fDrawState->PrintToStream();
|
|
||||||
else
|
|
||||||
printf(" NO DrawState valid pointer\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Prints pointer info kept by the current layer
|
|
||||||
void
|
|
||||||
Layer::PrintNode()
|
|
||||||
{
|
|
||||||
printf("-----------\nLayer %s\n", Name());
|
|
||||||
if (fParent)
|
|
||||||
printf("Parent: %s (%p)\n", fParent->Name(), fParent);
|
|
||||||
else
|
|
||||||
printf("Parent: NULL\n");
|
|
||||||
|
|
||||||
if (fPreviousSibling)
|
|
||||||
printf("Upper sibling: %s (%p)\n", fPreviousSibling->Name(), fPreviousSibling);
|
|
||||||
else
|
|
||||||
printf("Upper sibling: NULL\n");
|
|
||||||
|
|
||||||
if (fNextSibling)
|
|
||||||
printf("Lower sibling: %s (%p)\n", fNextSibling->Name(), fNextSibling);
|
|
||||||
else
|
|
||||||
printf("Lower sibling: NULL\n");
|
|
||||||
|
|
||||||
if (fFirstChild)
|
|
||||||
printf("Top child: %s (%p)\n", fFirstChild->Name(), fFirstChild);
|
|
||||||
else
|
|
||||||
printf("Top child: NULL\n");
|
|
||||||
|
|
||||||
if (fLastChild)
|
|
||||||
printf("Bottom child: %s (%p)\n", fLastChild->Name(), fLastChild);
|
|
||||||
else
|
|
||||||
printf("Bottom child: NULL\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Prints the tree hierarchy from the current layer down
|
|
||||||
void
|
|
||||||
Layer::PrintTree()
|
|
||||||
{
|
|
||||||
printf("\n Tree structure:\n");
|
|
||||||
printf("\t%s\t%s\n", Name(), IsHidden()? "Hidden": "NOT hidden");
|
|
||||||
for(Layer *lay = LastChild(); lay != NULL; lay = PreviousChild())
|
|
||||||
printf("\t%s\t%s\n", lay->Name(), lay->IsHidden()? "Hidden": "NOT hidden");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Returns the layer's ServerWindow
|
|
||||||
|
|
||||||
If the layer's ServerWindow has not been assigned, it attempts to find
|
|
||||||
the owning ServerWindow in the tree.
|
|
||||||
*/
|
|
||||||
ServerWindow*
|
|
||||||
Layer::SearchForServerWindow()
|
|
||||||
{
|
|
||||||
if (!fServerWin)
|
|
||||||
fServerWin=fParent->SearchForServerWindow();
|
|
||||||
|
|
||||||
return fServerWin;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sends an _UPDATE_ message to the client BWindow
|
|
||||||
status_t
|
|
||||||
Layer::SendUpdateMsg(BRegion& reg)
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
msg.what = _UPDATE_;
|
|
||||||
BRect rect(reg.Frame());
|
|
||||||
ConvertFromScreen2(&rect);
|
|
||||||
msg.AddRect("_rect", rect );
|
|
||||||
msg.AddRect("debug_rect", reg.Frame());
|
|
||||||
|
|
||||||
return Owner()->Window()->SendMessageToClient(&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddToViewsWithInvalidCoords
|
// AddToViewsWithInvalidCoords
|
||||||
void
|
void
|
||||||
Layer::AddToViewsWithInvalidCoords() const
|
Layer::AddToViewsWithInvalidCoords() const
|
||||||
@@ -1091,7 +878,7 @@ Layer::ScrolledByHook(float dx, float dy)
|
|||||||
|
|
||||||
//! converts a point from local to parent's coordinate system
|
//! converts a point from local to parent's coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToParent2(BPoint* pt) const
|
Layer::ConvertToParent(BPoint* pt) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1104,7 +891,7 @@ Layer::ConvertToParent2(BPoint* pt) const
|
|||||||
|
|
||||||
//! converts a rect from local to parent's coordinate system
|
//! converts a rect from local to parent's coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToParent2(BRect* rect) const
|
Layer::ConvertToParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1115,7 +902,7 @@ Layer::ConvertToParent2(BRect* rect) const
|
|||||||
|
|
||||||
//! converts a region from local to parent's coordinate system
|
//! converts a region from local to parent's coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToParent2(BRegion* reg) const
|
Layer::ConvertToParent(BRegion* reg) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1126,7 +913,7 @@ Layer::ConvertToParent2(BRegion* reg) const
|
|||||||
|
|
||||||
//! converts a point from parent's to local coordinate system
|
//! converts a point from parent's to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromParent2(BPoint* pt) const
|
Layer::ConvertFromParent(BPoint* pt) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1139,7 +926,7 @@ Layer::ConvertFromParent2(BPoint* pt) const
|
|||||||
|
|
||||||
//! converts a rect from parent's to local coordinate system
|
//! converts a rect from parent's to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromParent2(BRect* rect) const
|
Layer::ConvertFromParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1150,7 +937,7 @@ Layer::ConvertFromParent2(BRect* rect) const
|
|||||||
|
|
||||||
//! converts a region from parent's to local coordinate system
|
//! converts a region from parent's to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromParent2(BRegion* reg) const
|
Layer::ConvertFromParent(BRegion* reg) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
BPoint origin = BoundsOrigin();
|
BPoint origin = BoundsOrigin();
|
||||||
@@ -1161,61 +948,61 @@ Layer::ConvertFromParent2(BRegion* reg) const
|
|||||||
|
|
||||||
//! converts a point from local to screen coordinate system
|
//! converts a point from local to screen coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToScreen2(BPoint* pt) const
|
Layer::ConvertToScreen(BPoint* pt) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertToParent2(pt);
|
ConvertToParent(pt);
|
||||||
fParent->ConvertToScreen2(pt);
|
fParent->ConvertToScreen(pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! converts a rect from local to screen coordinate system
|
//! converts a rect from local to screen coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToScreen2(BRect* rect) const
|
Layer::ConvertToScreen(BRect* rect) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertToParent2(rect);
|
ConvertToParent(rect);
|
||||||
fParent->ConvertToScreen2(rect);
|
fParent->ConvertToScreen(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! converts a region from local to screen coordinate system
|
//! converts a region from local to screen coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertToScreen2(BRegion* reg) const
|
Layer::ConvertToScreen(BRegion* reg) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertToParent2(reg);
|
ConvertToParent(reg);
|
||||||
fParent->ConvertToScreen2(reg);
|
fParent->ConvertToScreen(reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! converts a point from screen to local coordinate system
|
//! converts a point from screen to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromScreen2(BPoint* pt) const
|
Layer::ConvertFromScreen(BPoint* pt) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertFromParent2(pt);
|
ConvertFromParent(pt);
|
||||||
fParent->ConvertFromScreen2(pt);
|
fParent->ConvertFromScreen(pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! converts a rect from screen to local coordinate system
|
//! converts a rect from screen to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromScreen2(BRect* rect) const
|
Layer::ConvertFromScreen(BRect* rect) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertFromParent2(rect);
|
ConvertFromParent(rect);
|
||||||
fParent->ConvertFromScreen2(rect);
|
fParent->ConvertFromScreen(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! converts a region from screen to local coordinate system
|
//! converts a region from screen to local coordinate system
|
||||||
void
|
void
|
||||||
Layer::ConvertFromScreen2(BRegion* reg) const
|
Layer::ConvertFromScreen(BRegion* reg) const
|
||||||
{
|
{
|
||||||
if (fParent) {
|
if (fParent) {
|
||||||
ConvertFromParent2(reg);
|
ConvertFromParent(reg);
|
||||||
fParent->ConvertFromScreen2(reg);
|
fParent->ConvertFromScreen(reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1229,7 +1016,7 @@ Layer::do_Hide()
|
|||||||
// save fullVisible so we know what to invalidate
|
// save fullVisible so we know what to invalidate
|
||||||
BRegion invalid(fFullVisible2);
|
BRegion invalid(fFullVisible2);
|
||||||
|
|
||||||
clear_visible_regions();
|
_ClearVisibleRegions();
|
||||||
|
|
||||||
if (invalid.CountRects() > 0) {
|
if (invalid.CountRects() > 0) {
|
||||||
fParent->MarkForRebuild(invalid);
|
fParent->MarkForRebuild(invalid);
|
||||||
@@ -1262,7 +1049,7 @@ Layer::do_Show()
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
Layer::resize_layer_frame_by(float x, float y)
|
Layer::_ResizeLayerFrameBy(float x, float y)
|
||||||
{
|
{
|
||||||
uint16 rm = fResizeMode & 0x0000FFFF;
|
uint16 rm = fResizeMode & 0x0000FFFF;
|
||||||
BRect newFrame = fFrame;
|
BRect newFrame = fFrame;
|
||||||
@@ -1334,14 +1121,14 @@ Layer::resize_layer_frame_by(float x, float y)
|
|||||||
ResizedByHook(dx, dy, true); // automatic
|
ResizedByHook(dx, dy, true); // automatic
|
||||||
|
|
||||||
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
||||||
child->resize_layer_frame_by(dx, dy);
|
child->_ResizeLayerFrameBy(dx, dy);
|
||||||
} else
|
} else
|
||||||
MovedByHook(dx, dy);
|
MovedByHook(dx, dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
Layer::rezize_layer_redraw_more(BRegion ®, float dx, float dy)
|
Layer::_RezizeLayerRedrawMore(BRegion ®, float dx, float dy)
|
||||||
{
|
{
|
||||||
if (dx == 0 && dy == 0)
|
if (dx == 0 && dy == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1367,13 +1154,13 @@ Layer::rezize_layer_redraw_more(BRegion ®, float dx, float dy)
|
|||||||
regZ.Include(oldBounds);
|
regZ.Include(oldBounds);
|
||||||
regZ.Exclude(oldBounds&lay->Bounds());
|
regZ.Exclude(oldBounds&lay->Bounds());
|
||||||
|
|
||||||
lay->ConvertToScreen2(®Z);
|
lay->ConvertToScreen(®Z);
|
||||||
|
|
||||||
// intersect that with this'(not lay's) fullVisible region
|
// intersect that with this'(not lay's) fullVisible region
|
||||||
regZ.IntersectWith(&fFullVisible2);
|
regZ.IntersectWith(&fFullVisible2);
|
||||||
reg.Include(®Z);
|
reg.Include(®Z);
|
||||||
|
|
||||||
lay->rezize_layer_redraw_more(reg,
|
lay->_RezizeLayerRedrawMore(reg,
|
||||||
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
|
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
|
||||||
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
|
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
|
||||||
|
|
||||||
@@ -1392,7 +1179,7 @@ Layer::rezize_layer_redraw_more(BRegion ®, float dx, float dy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
Layer::resize_layer_full_update_on_resize(BRegion ®, float dx, float dy)
|
Layer::_ResizeLayerFullUpdateOnResize(BRegion ®, float dx, float dy)
|
||||||
{
|
{
|
||||||
if (dx == 0 && dy == 0)
|
if (dx == 0 && dy == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1404,7 +1191,7 @@ Layer::resize_layer_full_update_on_resize(BRegion ®, float dx, float dy)
|
|||||||
if (lay->fFlags & B_FULL_UPDATE_ON_RESIZE && lay->fVisible2.CountRects() > 0)
|
if (lay->fFlags & B_FULL_UPDATE_ON_RESIZE && lay->fVisible2.CountRects() > 0)
|
||||||
reg.Include(&lay->fVisible2);
|
reg.Include(&lay->fVisible2);
|
||||||
|
|
||||||
lay->resize_layer_full_update_on_resize(reg,
|
lay->_ResizeLayerFullUpdateOnResize(reg,
|
||||||
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
|
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
|
||||||
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
|
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
|
||||||
}
|
}
|
||||||
@@ -1418,7 +1205,7 @@ Layer::do_ResizeBy(float dx, float dy)
|
|||||||
|
|
||||||
// resize children using their resize_mask.
|
// resize children using their resize_mask.
|
||||||
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
|
||||||
child->resize_layer_frame_by(dx, dy);
|
child->_ResizeLayerFrameBy(dx, dy);
|
||||||
|
|
||||||
// call hook function
|
// call hook function
|
||||||
if (dx != 0.0f || dy != 0.0f)
|
if (dx != 0.0f || dy != 0.0f)
|
||||||
@@ -1431,7 +1218,7 @@ Layer::do_ResizeBy(float dx, float dy)
|
|||||||
|
|
||||||
// in case they moved, bottom, right and center aligned layers must be redrawn
|
// in case they moved, bottom, right and center aligned layers must be redrawn
|
||||||
BRegion redrawMore;
|
BRegion redrawMore;
|
||||||
rezize_layer_redraw_more(redrawMore, dx, dy);
|
_RezizeLayerRedrawMore(redrawMore, dx, dy);
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -1457,11 +1244,11 @@ Layer::do_ResizeBy(float dx, float dy)
|
|||||||
redrawReg.Include(&redrawMore);
|
redrawReg.Include(&redrawMore);
|
||||||
|
|
||||||
// layers that had their frame modified must be entirely redrawn.
|
// layers that had their frame modified must be entirely redrawn.
|
||||||
rezize_layer_redraw_more(redrawReg, dx, dy);
|
_RezizeLayerRedrawMore(redrawReg, dx, dy);
|
||||||
|
|
||||||
// include layer's visible region in case we want a full update on resize
|
// include layer's visible region in case we want a full update on resize
|
||||||
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible2.Frame().IsValid()) {
|
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible2.Frame().IsValid()) {
|
||||||
resize_layer_full_update_on_resize(redrawReg, dx, dy);
|
_ResizeLayerFullUpdateOnResize(redrawReg, dx, dy);
|
||||||
|
|
||||||
redrawReg.Include(&fVisible2);
|
redrawReg.Include(&fVisible2);
|
||||||
redrawReg.Include(&oldVisible);
|
redrawReg.Include(&oldVisible);
|
||||||
@@ -1564,7 +1351,7 @@ Layer::GetWantedRegion(BRegion ®)
|
|||||||
{
|
{
|
||||||
// 1) set to frame in screen coords
|
// 1) set to frame in screen coords
|
||||||
BRect screenFrame(Bounds());
|
BRect screenFrame(Bounds());
|
||||||
ConvertToScreen2(&screenFrame);
|
ConvertToScreen(&screenFrame);
|
||||||
reg.Set(screenFrame);
|
reg.Set(screenFrame);
|
||||||
|
|
||||||
// 2) intersect with screen region
|
// 2) intersect with screen region
|
||||||
@@ -1589,7 +1376,7 @@ Layer::GetWantedRegion(BRegion ®)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::rebuild_visible_regions(const BRegion &invalid,
|
Layer::_RebuildVisibleRegions( const BRegion &invalid,
|
||||||
const BRegion &parentLocalVisible,
|
const BRegion &parentLocalVisible,
|
||||||
const Layer *startFrom)
|
const Layer *startFrom)
|
||||||
{
|
{
|
||||||
@@ -1633,7 +1420,7 @@ Layer::rebuild_visible_regions(const BRegion &invalid,
|
|||||||
fullRebuild = true;
|
fullRebuild = true;
|
||||||
|
|
||||||
if (fullRebuild)
|
if (fullRebuild)
|
||||||
lay->rebuild_visible_regions(invalid, common, lay->LastChild());
|
lay->_RebuildVisibleRegions(invalid, common, lay->LastChild());
|
||||||
|
|
||||||
// to let children know much they can take from parent's visible region
|
// to let children know much they can take from parent's visible region
|
||||||
common.Exclude(&lay->fFullVisible2);
|
common.Exclude(&lay->fFullVisible2);
|
||||||
@@ -1670,7 +1457,7 @@ Layer::rebuild_visible_regions(const BRegion &invalid,
|
|||||||
_ReserveRegions(common);
|
_ReserveRegions(common);
|
||||||
|
|
||||||
for (Layer *lay = LastChild(); lay; lay = PreviousChild()) {
|
for (Layer *lay = LastChild(); lay; lay = PreviousChild()) {
|
||||||
lay->rebuild_visible_regions(invalid, common, lay->LastChild());
|
lay->_RebuildVisibleRegions(invalid, common, lay->LastChild());
|
||||||
|
|
||||||
// to let children know much they can take from parent's visible region
|
// to let children know much they can take from parent's visible region
|
||||||
common.Exclude(&lay->fFullVisible2);
|
common.Exclude(&lay->fFullVisible2);
|
||||||
@@ -1687,7 +1474,7 @@ Layer::_ReserveRegions(BRegion ®)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Layer::clear_visible_regions()
|
Layer::_ClearVisibleRegions()
|
||||||
{
|
{
|
||||||
// OPT: maybe we should uncomment these lines for performance
|
// OPT: maybe we should uncomment these lines for performance
|
||||||
//if (fFullVisible2.CountRects() <= 0)
|
//if (fFullVisible2.CountRects() <= 0)
|
||||||
@@ -1696,7 +1483,7 @@ Layer::clear_visible_regions()
|
|||||||
fVisible2.MakeEmpty();
|
fVisible2.MakeEmpty();
|
||||||
fFullVisible2.MakeEmpty();
|
fFullVisible2.MakeEmpty();
|
||||||
for (Layer *child = LastChild(); child; child = PreviousChild())
|
for (Layer *child = LastChild(); child; child = PreviousChild())
|
||||||
child->clear_visible_regions();
|
child->_ClearVisibleRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark a region dirty so that the next region rebuild for us
|
// mark a region dirty so that the next region rebuild for us
|
||||||
@@ -1721,9 +1508,9 @@ Layer::TriggerRebuild()
|
|||||||
|
|
||||||
// localFullVisible.IntersectWith(&totalInvalidReg);
|
// localFullVisible.IntersectWith(&totalInvalidReg);
|
||||||
|
|
||||||
clear_visible_regions();
|
_ClearVisibleRegions();
|
||||||
|
|
||||||
rebuild_visible_regions(totalInvalidReg, localFullVisible, LastChild());
|
_RebuildVisibleRegions(totalInvalidReg, localFullVisible, LastChild());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+119
-165
@@ -71,16 +71,17 @@ class Layer {
|
|||||||
uint32 flags, DrawingEngine* driver);
|
uint32 flags, DrawingEngine* driver);
|
||||||
virtual ~Layer();
|
virtual ~Layer();
|
||||||
|
|
||||||
|
// name
|
||||||
|
virtual void SetName(const char* name);
|
||||||
|
inline const char* Name() const
|
||||||
|
{ return fName.String(); }
|
||||||
|
|
||||||
|
// children handling
|
||||||
void AddChild(Layer* child, ServerWindow* serverWin);
|
void AddChild(Layer* child, ServerWindow* serverWin);
|
||||||
void RemoveChild(Layer* child);
|
void RemoveChild(Layer* child);
|
||||||
void RemoveSelf();
|
void RemoveSelf();
|
||||||
bool HasChild(Layer* layer);
|
bool HasChild(Layer* layer);
|
||||||
|
|
||||||
void SetRootLayer(RootLayer* rl)
|
|
||||||
{ fRootLayer = rl; }
|
|
||||||
RootLayer* GetRootLayer() const
|
|
||||||
{ return fRootLayer; }
|
|
||||||
|
|
||||||
uint32 CountChildren() const;
|
uint32 CountChildren() const;
|
||||||
Layer* FindLayer(const int32 token);
|
Layer* FindLayer(const int32 token);
|
||||||
Layer* LayerAt(const BPoint &pt, bool recursive = true);
|
Layer* LayerAt(const BPoint &pt, bool recursive = true);
|
||||||
@@ -90,36 +91,59 @@ class Layer {
|
|||||||
virtual Layer* PreviousChild() const;
|
virtual Layer* PreviousChild() const;
|
||||||
virtual Layer* LastChild() const;
|
virtual Layer* LastChild() const;
|
||||||
|
|
||||||
virtual void SetName(const char* name);
|
void SetAsTopLayer(bool option)
|
||||||
inline const char* Name() const
|
{ fIsTopLayer = option; }
|
||||||
{ return fName.String(); }
|
inline bool IsTopLayer() const
|
||||||
|
{ return fIsTopLayer; }
|
||||||
|
|
||||||
inline uint32 ResizeMode() const
|
// visible state
|
||||||
{ return fResizeMode; }
|
|
||||||
|
|
||||||
virtual void SetFlags(uint32 flags);
|
|
||||||
inline uint32 Flags() const
|
|
||||||
{ return fFlags; }
|
|
||||||
|
|
||||||
virtual void Draw(const BRect& r);
|
|
||||||
|
|
||||||
void Show(bool invalidate = true);
|
void Show(bool invalidate = true);
|
||||||
void Hide(bool invalidate = true);
|
void Hide(bool invalidate = true);
|
||||||
bool IsHidden() const;
|
bool IsHidden() const;
|
||||||
|
bool IsVisuallyHidden() const;
|
||||||
|
|
||||||
// graphic state
|
// graphic state and attributes
|
||||||
void PushState();
|
void PushState();
|
||||||
void PopState();
|
void PopState();
|
||||||
DrawState* CurrentState() const { return fDrawState; }
|
DrawState* CurrentState() const { return fDrawState; }
|
||||||
|
|
||||||
|
void SetViewColor(const RGBColor& color);
|
||||||
|
inline const RGBColor& ViewColor() const
|
||||||
|
{ return fViewColor; }
|
||||||
|
void SetBackgroundBitmap(const ServerBitmap* bitmap);
|
||||||
|
inline const ServerBitmap* BackgroundBitmap() const
|
||||||
|
{ return fBackgroundBitmap; }
|
||||||
|
void SetOverlayBitmap(const ServerBitmap* bitmap);
|
||||||
|
inline const ServerBitmap* OverlayBitmap() const
|
||||||
|
{ return fOverlayBitmap; }
|
||||||
|
|
||||||
// coordinate system
|
// coordinate system
|
||||||
BRect Bounds() const;
|
BRect Bounds() const;
|
||||||
BRect Frame() const;
|
BRect Frame() const;
|
||||||
|
BPoint BoundsOrigin() const; // BoundsFrameDiff()?
|
||||||
|
float Scale() const;
|
||||||
|
|
||||||
|
void ConvertToParent(BPoint* pt) const;
|
||||||
|
void ConvertToParent(BRect* rect) const;
|
||||||
|
void ConvertToParent(BRegion* reg) const;
|
||||||
|
void ConvertFromParent(BPoint* pt) const;
|
||||||
|
void ConvertFromParent(BRect* rect) const;
|
||||||
|
void ConvertFromParent(BRegion* reg) const;
|
||||||
|
|
||||||
|
void ConvertToScreen(BPoint* pt) const;
|
||||||
|
void ConvertToScreen(BRect* rect) const;
|
||||||
|
void ConvertToScreen(BRegion* reg) const;
|
||||||
|
void ConvertFromScreen(BPoint* pt) const;
|
||||||
|
void ConvertFromScreen(BRect* rect) const;
|
||||||
|
void ConvertFromScreen(BRegion* reg) const;
|
||||||
|
|
||||||
virtual void MoveBy(float x, float y);
|
virtual void MoveBy(float x, float y);
|
||||||
virtual void ResizeBy(float x, float y);
|
virtual void ResizeBy(float x, float y);
|
||||||
virtual void ScrollBy(float x, float y);
|
virtual void ScrollBy(float x, float y);
|
||||||
|
void CopyBits(BRect& src, BRect& dst,
|
||||||
|
int32 xOffset, int32 yOffset);
|
||||||
|
|
||||||
|
// input handling
|
||||||
virtual void MouseDown(const BMessage *msg);
|
virtual void MouseDown(const BMessage *msg);
|
||||||
virtual void MouseUp(const BMessage *msg);
|
virtual void MouseUp(const BMessage *msg);
|
||||||
virtual void MouseMoved(const BMessage *msg);
|
virtual void MouseMoved(const BMessage *msg);
|
||||||
@@ -135,151 +159,103 @@ class Layer {
|
|||||||
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
|
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
|
||||||
virtual void Activated(bool active);
|
virtual void Activated(bool active);
|
||||||
|
|
||||||
BPoint BoundsOrigin() const; // BoundsFrameDiff()?
|
// action hooks
|
||||||
float Scale() const;
|
|
||||||
|
|
||||||
BPoint ConvertToParent(BPoint pt);
|
|
||||||
BRect ConvertToParent(BRect rect);
|
|
||||||
BRegion ConvertToParent(BRegion* reg);
|
|
||||||
|
|
||||||
BPoint ConvertFromParent(BPoint pt);
|
|
||||||
BRect ConvertFromParent(BRect rect);
|
|
||||||
BRegion ConvertFromParent(BRegion* reg);
|
|
||||||
|
|
||||||
BPoint ConvertToTop(BPoint pt);
|
|
||||||
BRect ConvertToTop(BRect rect);
|
|
||||||
BRegion ConvertToTop(BRegion* reg);
|
|
||||||
|
|
||||||
BPoint ConvertFromTop(BPoint pt);
|
|
||||||
BRect ConvertFromTop(BRect rect);
|
|
||||||
BRegion ConvertFromTop(BRegion *reg);
|
|
||||||
|
|
||||||
|
|
||||||
DrawingEngine* GetDrawingEngine() const
|
|
||||||
{ return fDriver; }
|
|
||||||
|
|
||||||
ServerWindow* Window() const
|
|
||||||
{ return fServerWin; }
|
|
||||||
|
|
||||||
ServerApp* App() const
|
|
||||||
{ return fServerWin? fServerWin->App(): NULL; }
|
|
||||||
|
|
||||||
inline WinBorder* Owner() const
|
|
||||||
{ return fOwner; }
|
|
||||||
|
|
||||||
virtual bool HasClient()
|
|
||||||
{ return true; }
|
|
||||||
|
|
||||||
uint32 EventMask() const
|
|
||||||
{ return fEventMask; }
|
|
||||||
|
|
||||||
uint32 EventOptions() const
|
|
||||||
{ return fEventOptions; }
|
|
||||||
|
|
||||||
inline void QuietlySetEventMask(uint32 em)
|
|
||||||
{ fEventMask = em; }
|
|
||||||
|
|
||||||
inline void QuietlySetEventOptions(uint32 eo)
|
|
||||||
{ fEventOptions = eo; }
|
|
||||||
|
|
||||||
void PruneTree();
|
|
||||||
|
|
||||||
// debugging
|
|
||||||
void PrintToStream();
|
|
||||||
void PrintNode();
|
|
||||||
void PrintTree();
|
|
||||||
|
|
||||||
// server "private" - should not be used
|
|
||||||
void SetAsTopLayer(bool option)
|
|
||||||
{ fIsTopLayer = option; }
|
|
||||||
|
|
||||||
inline bool IsTopLayer() const
|
|
||||||
{ return fIsTopLayer; }
|
|
||||||
|
|
||||||
BRegion* ClippingRegion() const
|
|
||||||
{ return fClipReg; }
|
|
||||||
|
|
||||||
// automatic background blanking by app_server
|
|
||||||
void SetViewColor(const RGBColor& color);
|
|
||||||
inline const RGBColor& ViewColor() const
|
|
||||||
{ return fViewColor; }
|
|
||||||
|
|
||||||
void SetBackgroundBitmap(const ServerBitmap* bitmap);
|
|
||||||
inline const ServerBitmap* BackgroundBitmap() const
|
|
||||||
{ return fBackgroundBitmap; }
|
|
||||||
|
|
||||||
// overlay support
|
|
||||||
// TODO: This can't be all, what about color key?
|
|
||||||
void SetOverlayBitmap(const ServerBitmap* bitmap);
|
|
||||||
inline const ServerBitmap* OverlayBitmap() const
|
|
||||||
{ return fOverlayBitmap; }
|
|
||||||
|
|
||||||
void CopyBits(BRect& src, BRect& dst,
|
|
||||||
int32 xOffset, int32 yOffset);
|
|
||||||
|
|
||||||
inline const BRegion& VisibleRegion() const { return fVisible2; }
|
|
||||||
inline const BRegion& FullVisible() const { return fFullVisible2; }
|
|
||||||
|
|
||||||
void MarkForRebuild(const BRegion &dirty);
|
|
||||||
void TriggerRebuild();
|
|
||||||
void _GetAllRebuildDirty(BRegion *totalReg);
|
|
||||||
void _AllRedraw(const BRegion &invalid);
|
|
||||||
|
|
||||||
|
|
||||||
virtual void GetWantedRegion(BRegion& reg);
|
|
||||||
|
|
||||||
virtual void MovedByHook(float dx, float dy);
|
virtual void MovedByHook(float dx, float dy);
|
||||||
virtual void ResizedByHook(float dx, float dy, bool automatic);
|
virtual void ResizedByHook(float dx, float dy, bool automatic);
|
||||||
virtual void ScrolledByHook(float dx, float dy);
|
virtual void ScrolledByHook(float dx, float dy);
|
||||||
|
|
||||||
void ConvertToParent2(BPoint* pt) const;
|
// app_server objects getters
|
||||||
void ConvertToParent2(BRect* rect) const;
|
ServerWindow* Window() const
|
||||||
void ConvertToParent2(BRegion* reg) const;
|
{ return fServerWin; }
|
||||||
void ConvertFromParent2(BPoint* pt) const;
|
ServerApp* App() const
|
||||||
void ConvertFromParent2(BRect* rect) const;
|
{ return fServerWin? fServerWin->App(): NULL; }
|
||||||
void ConvertFromParent2(BRegion* reg) const;
|
inline WinBorder* Owner() const
|
||||||
|
{ return fOwner; }
|
||||||
|
RootLayer* GetRootLayer() const
|
||||||
|
{ return fRootLayer; }
|
||||||
|
void SetRootLayer(RootLayer* rl)
|
||||||
|
{ fRootLayer = rl; }
|
||||||
|
DrawingEngine* GetDrawingEngine() const
|
||||||
|
{ return fDriver; }
|
||||||
|
|
||||||
void ConvertToScreen2(BPoint* pt) const;
|
// flags
|
||||||
void ConvertToScreen2(BRect* rect) const;
|
uint32 EventMask() const
|
||||||
void ConvertToScreen2(BRegion* reg) const;
|
{ return fEventMask; }
|
||||||
void ConvertFromScreen2(BPoint* pt) const;
|
uint32 EventOptions() const
|
||||||
void ConvertFromScreen2(BRect* rect) const;
|
{ return fEventOptions; }
|
||||||
void ConvertFromScreen2(BRegion* reg) const;
|
inline void QuietlySetEventMask(uint32 em)
|
||||||
bool IsVisuallyHidden() const;
|
{ fEventMask = em; }
|
||||||
|
inline void QuietlySetEventOptions(uint32 eo)
|
||||||
|
{ fEventOptions = eo; }
|
||||||
|
inline uint32 ResizeMode() const
|
||||||
|
{ return fResizeMode; }
|
||||||
|
inline uint32 Flags() const
|
||||||
|
{ return fFlags; }
|
||||||
|
void SetFlags(uint32 flags);
|
||||||
|
|
||||||
|
// clipping stuff and redraw
|
||||||
|
inline const BRegion& VisibleRegion() const { return fVisible2; }
|
||||||
|
inline const BRegion& FullVisible() const { return fFullVisible2; }
|
||||||
|
|
||||||
|
virtual void GetWantedRegion(BRegion& reg);
|
||||||
|
|
||||||
|
void MarkForRebuild(const BRegion &dirty);
|
||||||
|
void TriggerRebuild();
|
||||||
|
void _GetAllRebuildDirty(BRegion *totalReg);
|
||||||
|
|
||||||
|
virtual void Draw(const BRect& r);
|
||||||
|
void _AllRedraw(const BRegion &invalid);
|
||||||
|
|
||||||
|
// others
|
||||||
|
void PruneTree();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class RootLayer;
|
||||||
|
friend class WinBorder;
|
||||||
|
friend class ServerWindow;
|
||||||
|
|
||||||
void do_Hide();
|
void do_Hide();
|
||||||
void do_Show();
|
void do_Show();
|
||||||
void do_MoveBy(float dx, float dy);
|
void do_MoveBy(float dx, float dy);
|
||||||
void do_ResizeBy(float dx, float dy);
|
void do_ResizeBy(float dx, float dy);
|
||||||
void do_ScrollBy(float dx, float dy);
|
void do_ScrollBy(float dx, float dy);
|
||||||
|
|
||||||
void rebuild_visible_regions(const BRegion &invalid,
|
|
||||||
const BRegion &parentLocalVisible,
|
|
||||||
const Layer *startFrom);
|
|
||||||
|
|
||||||
virtual void _ReserveRegions(BRegion ®);
|
|
||||||
|
|
||||||
void clear_visible_regions();
|
|
||||||
void resize_layer_frame_by(float x, float y);
|
|
||||||
void rezize_layer_redraw_more(BRegion ®, float dx, float dy);
|
|
||||||
void resize_layer_full_update_on_resize(BRegion ®, float dx, float dy);
|
|
||||||
|
|
||||||
void do_CopyBits(BRect& src, BRect& dst,
|
void do_CopyBits(BRect& src, BRect& dst,
|
||||||
int32 xOffset, int32 yOffset);
|
int32 xOffset, int32 yOffset);
|
||||||
|
|
||||||
protected:
|
// private clipping stuff
|
||||||
friend class RootLayer;
|
virtual void _ReserveRegions(BRegion ®);
|
||||||
friend class WinBorder;
|
void _RebuildVisibleRegions( const BRegion &invalid,
|
||||||
friend class ServerWindow;
|
const BRegion &parentLocalVisible,
|
||||||
|
const Layer *startFrom);
|
||||||
|
void _ClearVisibleRegions();
|
||||||
|
void _ResizeLayerFrameBy(float x, float y);
|
||||||
|
void _RezizeLayerRedrawMore(BRegion ®, float dx, float dy);
|
||||||
|
void _ResizeLayerFullUpdateOnResize(BRegion ®, float dx, float dy);
|
||||||
|
|
||||||
|
// for updating client-side coordinates
|
||||||
|
void AddToViewsWithInvalidCoords() const;
|
||||||
|
void SendViewCoordUpdateMsg() const;
|
||||||
|
|
||||||
|
|
||||||
|
BString fName;
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
// TODO: should be removed or reused in a similar fashion
|
// TODO: should be removed or reused in a similar fashion
|
||||||
// to hold the accumulated origins from the graphics state stack.
|
// to hold the accumulated origins from the graphics state stack.
|
||||||
// The same needs to be done for "scale". (Keeping an accumulated
|
// The same needs to be done for "scale". (Keeping an accumulated
|
||||||
// value.)
|
// value.)
|
||||||
// BPoint fBoundsLeftTop;
|
// BPoint fBoundsLeftTop;
|
||||||
|
|
||||||
|
BRegion fVisible2;
|
||||||
|
BRegion fFullVisible2;
|
||||||
|
BRegion fDirtyForRebuild;
|
||||||
|
|
||||||
|
DrawingEngine* fDriver;
|
||||||
|
RootLayer* fRootLayer;
|
||||||
|
ServerWindow* fServerWin;
|
||||||
WinBorder* fOwner;
|
WinBorder* fOwner;
|
||||||
|
|
||||||
|
DrawState* fDrawState;
|
||||||
|
|
||||||
Layer* fParent;
|
Layer* fParent;
|
||||||
Layer* fPreviousSibling;
|
Layer* fPreviousSibling;
|
||||||
Layer* fNextSibling;
|
Layer* fNextSibling;
|
||||||
@@ -288,37 +264,15 @@ class Layer {
|
|||||||
|
|
||||||
mutable Layer* fCurrent;
|
mutable Layer* fCurrent;
|
||||||
|
|
||||||
private:
|
|
||||||
BRegion fVisible2;
|
|
||||||
BRegion fFullVisible2;
|
|
||||||
BRegion fDirtyForRebuild;
|
|
||||||
protected:
|
|
||||||
|
|
||||||
BRegion* fClipReg;
|
|
||||||
|
|
||||||
ServerWindow* fServerWin;
|
|
||||||
BString fName;
|
|
||||||
int32 fViewToken;
|
int32 fViewToken;
|
||||||
uint32 fFlags;
|
uint32 fFlags;
|
||||||
|
uint16 fAdFlags;
|
||||||
uint32 fResizeMode;
|
uint32 fResizeMode;
|
||||||
uint32 fEventMask;
|
uint32 fEventMask;
|
||||||
uint32 fEventOptions;
|
uint32 fEventOptions;
|
||||||
|
|
||||||
bool fHidden;
|
bool fHidden;
|
||||||
bool fIsTopLayer;
|
bool fIsTopLayer;
|
||||||
uint16 fAdFlags;
|
|
||||||
|
|
||||||
DrawingEngine* fDriver;
|
|
||||||
DrawState* fDrawState;
|
|
||||||
|
|
||||||
RootLayer* fRootLayer;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ServerWindow* SearchForServerWindow();
|
|
||||||
|
|
||||||
status_t SendUpdateMsg(BRegion& reg);
|
|
||||||
void AddToViewsWithInvalidCoords() const;
|
|
||||||
void SendViewCoordUpdateMsg() const;
|
|
||||||
|
|
||||||
RGBColor fViewColor;
|
RGBColor fViewColor;
|
||||||
|
|
||||||
const ServerBitmap* fBackgroundBitmap;
|
const ServerBitmap* fBackgroundBitmap;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap,
|
|||||||
fBitmap(bitmap),
|
fBitmap(bitmap),
|
||||||
fHWInterface(new BitmapHWInterface(fBitmap))
|
fHWInterface(new BitmapHWInterface(fBitmap))
|
||||||
{
|
{
|
||||||
fDriver->SetHWInterface(fHWInterface);
|
GetDrawingEngine()->SetHWInterface(fHWInterface);
|
||||||
fDriver->Initialize();
|
GetDrawingEngine()->Initialize();
|
||||||
fDriver->Update();
|
GetDrawingEngine()->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
@@ -39,8 +39,8 @@ OffscreenWinBorder::~OffscreenWinBorder()
|
|||||||
{
|
{
|
||||||
fHWInterface->WriteLock();
|
fHWInterface->WriteLock();
|
||||||
// Unlike normal Layers, we own the DrawingEngine instance
|
// Unlike normal Layers, we own the DrawingEngine instance
|
||||||
fDriver->Shutdown();
|
GetDrawingEngine()->Shutdown();
|
||||||
delete fDriver;
|
delete GetDrawingEngine();
|
||||||
fHWInterface->Shutdown();
|
fHWInterface->Shutdown();
|
||||||
fHWInterface->WriteUnlock();
|
fHWInterface->WriteUnlock();
|
||||||
delete fHWInterface;
|
delete fHWInterface;
|
||||||
|
|||||||
@@ -830,7 +830,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
MarkForRebuild(layer->FullVisible());
|
MarkForRebuild(layer->FullVisible());
|
||||||
MarkForRedraw(layer->FullVisible());
|
MarkForRedraw(layer->FullVisible());
|
||||||
|
|
||||||
layer->clear_visible_regions();
|
layer->_ClearVisibleRegions();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
oldStrippedList.AddItem(layer);
|
oldStrippedList.AddItem(layer);
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public:
|
|||||||
RGBColor BGColor(void) const;
|
RGBColor BGColor(void) const;
|
||||||
|
|
||||||
inline int32 Buttons(void) { return fButtons; }
|
inline int32 Buttons(void) { return fButtons; }
|
||||||
virtual bool HasClient(void) { return false; }
|
|
||||||
|
|
||||||
void SetDragMessage(BMessage *msg);
|
void SetDragMessage(BMessage *msg);
|
||||||
BMessage* DragMessage(void) const;
|
BMessage* DragMessage(void) const;
|
||||||
|
|||||||
@@ -564,8 +564,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<BRect>(&dst);
|
link.Read<BRect>(&dst);
|
||||||
|
|
||||||
// TODO: Are origin and scale handled in this conversion?
|
// TODO: Are origin and scale handled in this conversion?
|
||||||
src = fCurrentLayer->ConvertToTop(src);
|
fCurrentLayer->ConvertToScreen(&src);
|
||||||
dst = fCurrentLayer->ConvertToTop(dst);
|
fCurrentLayer->ConvertToScreen(&dst);
|
||||||
|
|
||||||
int32 xOffset = (int32)(dst.left - src.left);
|
int32 xOffset = (int32)(dst.left - src.left);
|
||||||
int32 yOffset = (int32)(dst.top - src.top);
|
int32 yOffset = (int32)(dst.top - src.top);
|
||||||
@@ -1085,8 +1085,11 @@ if (myRootLayer)
|
|||||||
fLink.StartMessage(SERVER_TRUE);
|
fLink.StartMessage(SERVER_TRUE);
|
||||||
fLink.Attach<int32>(rectCount);
|
fLink.Attach<int32>(rectCount);
|
||||||
|
|
||||||
for (int32 i = 0; i < rectCount; i++)
|
for (int32 i = 0; i < rectCount; i++) {
|
||||||
fLink.Attach<BRect>(fCurrentLayer->ConvertFromTop(fCurrentLayer->fVisible2.RectAt(i)));
|
BRect converted(fCurrentLayer->fVisible2.RectAt(i));
|
||||||
|
fCurrentLayer->ConvertFromScreen(&converted);
|
||||||
|
fLink.Attach<BRect>(converted);
|
||||||
|
}
|
||||||
|
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
}
|
}
|
||||||
@@ -1099,14 +1102,15 @@ if (myRootLayer)
|
|||||||
|
|
||||||
// TODO: Watch out for the coordinate system in AS_LAYER_SET_CLIP_REGION
|
// TODO: Watch out for the coordinate system in AS_LAYER_SET_CLIP_REGION
|
||||||
int32 noOfRects;
|
int32 noOfRects;
|
||||||
BRect r;
|
|
||||||
|
|
||||||
link.Read<int32>(&noOfRects);
|
link.Read<int32>(&noOfRects);
|
||||||
|
|
||||||
BRegion region;
|
BRegion region;
|
||||||
for (int i = 0; i < noOfRects; i++) {
|
for (int i = 0; i < noOfRects; i++) {
|
||||||
|
BRect r;
|
||||||
link.Read<BRect>(&r);
|
link.Read<BRect>(&r);
|
||||||
region.Include(fCurrentLayer->ConvertToTop(r));
|
fCurrentLayer->ConvertToScreen(&r);
|
||||||
|
region.Include(r);
|
||||||
}
|
}
|
||||||
// TODO: Turned off user clipping for now (will probably not harm anything but performance right now)
|
// TODO: Turned off user clipping for now (will probably not harm anything but performance right now)
|
||||||
// We need to integrate user clipping more, in Layer::PopState, the clipping needs to be
|
// We need to integrate user clipping more, in Layer::PopState, the clipping needs to be
|
||||||
@@ -1128,8 +1132,10 @@ if (myRootLayer)
|
|||||||
link.Read<BRect>(&invalRect);
|
link.Read<BRect>(&invalRect);
|
||||||
|
|
||||||
if (myRootLayer) {
|
if (myRootLayer) {
|
||||||
BRect converted(fCurrentLayer->ConvertToTop(invalRect.LeftTop()),
|
BRect converted(invalRect.LeftTop(), invalRect.RightBottom());
|
||||||
fCurrentLayer->ConvertToTop(invalRect.RightBottom()));
|
|
||||||
|
fCurrentLayer->ConvertToScreen(&converted);
|
||||||
|
|
||||||
BRegion invalidRegion(converted);
|
BRegion invalidRegion(converted);
|
||||||
invalidRegion.IntersectWith(&fCurrentLayer->VisibleRegion());
|
invalidRegion.IntersectWith(&fCurrentLayer->VisibleRegion());
|
||||||
myRootLayer->MarkForRedraw(invalidRegion);
|
myRootLayer->MarkForRedraw(invalidRegion);
|
||||||
@@ -1155,7 +1161,7 @@ if (myRootLayer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (myRootLayer) {
|
if (myRootLayer) {
|
||||||
fCurrentLayer->ConvertToScreen2(&invalidReg);
|
fCurrentLayer->ConvertToScreen(&invalidReg);
|
||||||
|
|
||||||
myRootLayer->MarkForRedraw(invalidReg);
|
myRootLayer->MarkForRedraw(invalidReg);
|
||||||
myRootLayer->TriggerRedraw();
|
myRootLayer->TriggerRedraw();
|
||||||
@@ -1647,9 +1653,9 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
BPoint p1(x1,y1);
|
BPoint p1(x1,y1);
|
||||||
BPoint p2(x2,y2);
|
BPoint p2(x2,y2);
|
||||||
driver->StrokeLine(fCurrentLayer->ConvertToTop(p1),
|
fCurrentLayer->ConvertToScreen(&p1);
|
||||||
fCurrentLayer->ConvertToTop(p2),
|
fCurrentLayer->ConvertToScreen(&p2);
|
||||||
fCurrentLayer->CurrentState());
|
driver->StrokeLine(p1, p2, fCurrentLayer->CurrentState());
|
||||||
|
|
||||||
// We update the pen here because many DrawingEngine calls which do not update the
|
// We update the pen here because many DrawingEngine calls which do not update the
|
||||||
// pen position actually call StrokeLine
|
// pen position actually call StrokeLine
|
||||||
@@ -1667,7 +1673,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
link.Read<BRect>(&rect);
|
link.Read<BRect>(&rect);
|
||||||
|
|
||||||
driver->InvertRect(fCurrentLayer->ConvertToTop(rect));
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
|
driver->InvertRect(rect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_STROKE_RECT:
|
case AS_STROKE_RECT:
|
||||||
@@ -1681,7 +1688,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<float>(&bottom);
|
link.Read<float>(&bottom);
|
||||||
BRect rect(left,top,right,bottom);
|
BRect rect(left,top,right,bottom);
|
||||||
|
|
||||||
driver->StrokeRect(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->CurrentState());
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
|
driver->StrokeRect(rect, fCurrentLayer->CurrentState());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1691,7 +1699,9 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
BRect rect;
|
BRect rect;
|
||||||
link.Read<BRect>(&rect);
|
link.Read<BRect>(&rect);
|
||||||
driver->FillRect(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->CurrentState());
|
|
||||||
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
|
driver->FillRect(rect, fCurrentLayer->CurrentState());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
||||||
@@ -1708,7 +1718,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
if (sbmp) {
|
if (sbmp) {
|
||||||
BRect src = sbmp->Bounds();
|
BRect src = sbmp->Bounds();
|
||||||
BRect dst = src.OffsetToCopy(point);
|
BRect dst = src.OffsetToCopy(point);
|
||||||
dst = fCurrentLayer->ConvertToTop(dst);
|
fCurrentLayer->ConvertToScreen(&dst);
|
||||||
|
|
||||||
driver->DrawBitmap(sbmp, src, dst, fCurrentLayer->CurrentState());
|
driver->DrawBitmap(sbmp, src, dst, fCurrentLayer->CurrentState());
|
||||||
}
|
}
|
||||||
@@ -1729,7 +1739,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
||||||
if (sbmp) {
|
if (sbmp) {
|
||||||
dstRect = fCurrentLayer->ConvertToTop(dstRect);
|
fCurrentLayer->ConvertToScreen(&dstRect);
|
||||||
|
|
||||||
driver->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->CurrentState());
|
driver->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->CurrentState());
|
||||||
}
|
}
|
||||||
@@ -1749,8 +1759,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<float>(&angle);
|
link.Read<float>(&angle);
|
||||||
link.Read<float>(&span);
|
link.Read<float>(&span);
|
||||||
|
|
||||||
driver->DrawArc(fCurrentLayer->ConvertToTop(r), angle, span,
|
fCurrentLayer->ConvertToScreen(&r);
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_ARC);
|
driver->DrawArc(r, angle, span, fCurrentLayer->CurrentState(), code == AS_FILL_ARC);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1762,7 +1772,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
BPoint pts[4];
|
BPoint pts[4];
|
||||||
for (int32 i = 0; i < 4; i++) {
|
for (int32 i = 0; i < 4; i++) {
|
||||||
link.Read<BPoint>(&(pts[i]));
|
link.Read<BPoint>(&(pts[i]));
|
||||||
pts[i] = fCurrentLayer->ConvertToTop(pts[i]);
|
fCurrentLayer->ConvertToScreen(&pts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver->DrawBezier(pts, fCurrentLayer->CurrentState(), code == AS_FILL_BEZIER);
|
driver->DrawBezier(pts, fCurrentLayer->CurrentState(), code == AS_FILL_BEZIER);
|
||||||
@@ -1777,8 +1787,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
link.Read<BRect>(&rect);
|
link.Read<BRect>(&rect);
|
||||||
|
|
||||||
driver->DrawEllipse(fCurrentLayer->ConvertToTop(rect),
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_ELLIPSE);
|
driver->DrawEllipse(rect, fCurrentLayer->CurrentState(), code == AS_FILL_ELLIPSE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1793,8 +1803,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<float>(&xrad);
|
link.Read<float>(&xrad);
|
||||||
link.Read<float>(&yrad);
|
link.Read<float>(&yrad);
|
||||||
|
|
||||||
driver->DrawRoundRect(fCurrentLayer->ConvertToTop(rect), xrad, yrad,
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_ROUNDRECT);
|
driver->DrawRoundRect(rect, xrad, yrad, fCurrentLayer->CurrentState(), code == AS_FILL_ROUNDRECT);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1808,13 +1818,13 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
|
|
||||||
for (int32 i = 0; i < 3; i++) {
|
for (int32 i = 0; i < 3; i++) {
|
||||||
link.Read<BPoint>(&(pts[i]));
|
link.Read<BPoint>(&(pts[i]));
|
||||||
pts[i] = fCurrentLayer->ConvertToTop(pts[i]);
|
fCurrentLayer->ConvertToScreen(&pts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
link.Read<BRect>(&rect);
|
link.Read<BRect>(&rect);
|
||||||
|
|
||||||
driver->DrawTriangle(pts, fCurrentLayer->ConvertToTop(rect),
|
fCurrentLayer->ConvertToScreen(&rect);
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_TRIANGLE);
|
driver->DrawTriangle(pts, rect, fCurrentLayer->CurrentState(), code == AS_FILL_TRIANGLE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1838,7 +1848,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
||||||
|
|
||||||
for (int32 i = 0; i < pointcount; i++)
|
for (int32 i = 0; i < pointcount; i++)
|
||||||
pointlist[i] = fCurrentLayer->ConvertToTop(pointlist[i]);
|
fCurrentLayer->ConvertToScreen(&pointlist[i]);
|
||||||
|
|
||||||
driver->DrawPolygon(pointlist, pointcount, polyframe,
|
driver->DrawPolygon(pointlist, pointcount, polyframe,
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_POLYGON,
|
fCurrentLayer->CurrentState(), code == AS_FILL_POLYGON,
|
||||||
@@ -1867,7 +1877,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read(ptlist, ptcount * sizeof(BPoint));
|
link.Read(ptlist, ptcount * sizeof(BPoint));
|
||||||
|
|
||||||
for (int32 i = 0; i < ptcount; i++)
|
for (int32 i = 0; i < ptcount; i++)
|
||||||
ptlist[i] = fCurrentLayer->ConvertToTop(ptlist[i]);
|
fCurrentLayer->ConvertToScreen(&ptlist[i]);
|
||||||
|
|
||||||
driver->DrawShape(shaperect, opcount, oplist, ptcount, ptlist,
|
driver->DrawShape(shaperect, opcount, oplist, ptcount, ptlist,
|
||||||
fCurrentLayer->CurrentState(), code == AS_FILL_SHAPE);
|
fCurrentLayer->CurrentState(), code == AS_FILL_SHAPE);
|
||||||
@@ -1894,8 +1904,10 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
// least it works for now. :)
|
// least it works for now. :)
|
||||||
BRegion region;
|
BRegion region;
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
region.Include(fCurrentLayer->ConvertToTop(rects[i]));
|
region.Include(rects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fCurrentLayer->ConvertToScreen(®ion);
|
||||||
driver->FillRegion(region, fCurrentLayer->CurrentState());
|
driver->FillRegion(region, fCurrentLayer->CurrentState());
|
||||||
|
|
||||||
delete[] rects;
|
delete[] rects;
|
||||||
@@ -1927,8 +1939,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<float>(&(index->pt2.y));
|
link.Read<float>(&(index->pt2.y));
|
||||||
link.Read<rgb_color>(&(index->color));
|
link.Read<rgb_color>(&(index->color));
|
||||||
|
|
||||||
index->pt1 = fCurrentLayer->ConvertToTop(index->pt1);
|
fCurrentLayer->ConvertToScreen(&index->pt1);
|
||||||
index->pt2 = fCurrentLayer->ConvertToTop(index->pt2);
|
fCurrentLayer->ConvertToScreen(&index->pt2);
|
||||||
}
|
}
|
||||||
driver->StrokeLineArray(linecount,linedata,fCurrentLayer->CurrentState());
|
driver->StrokeLineArray(linecount,linedata,fCurrentLayer->CurrentState());
|
||||||
}
|
}
|
||||||
@@ -1947,9 +1959,8 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<escapement_delta>(&delta);
|
link.Read<escapement_delta>(&delta);
|
||||||
link.ReadString(&string);
|
link.ReadString(&string);
|
||||||
|
|
||||||
driver->DrawString(string, length,
|
fCurrentLayer->ConvertToScreen(&location);
|
||||||
fCurrentLayer->ConvertToTop(location),
|
driver->DrawString(string, length, location, fCurrentLayer->CurrentState(), &delta);
|
||||||
fCurrentLayer->CurrentState(), &delta);
|
|
||||||
|
|
||||||
free(string);
|
free(string);
|
||||||
break;
|
break;
|
||||||
@@ -2141,7 +2152,7 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
|
|||||||
BRegion exclude = const_cast<BRegion &>(border->VisibleRegion());
|
BRegion exclude = const_cast<BRegion &>(border->VisibleRegion());
|
||||||
clipRegion.Exclude(&exclude);
|
clipRegion.Exclude(&exclude);
|
||||||
|
|
||||||
border->ConvertToTop(&clipRegion);
|
border->ConvertToScreen(&clipRegion);
|
||||||
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount);
|
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount);
|
||||||
fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
|
fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
|
||||||
|
|
||||||
|
|||||||
@@ -761,13 +761,13 @@ WinBorder::GetWantedRegion(BRegion ®)
|
|||||||
if (fRebuildDecRegion)
|
if (fRebuildDecRegion)
|
||||||
set_decorator_region(Bounds());
|
set_decorator_region(Bounds());
|
||||||
|
|
||||||
BRect screenFrame(Bounds());
|
BRect screenFrame(Bounds());
|
||||||
ConvertToScreen2(&screenFrame);
|
ConvertToScreen(&screenFrame);
|
||||||
reg.Set(screenFrame);
|
reg.Set(screenFrame);
|
||||||
|
|
||||||
reg.Include(&fDecRegion);
|
reg.Include(&fDecRegion);
|
||||||
|
|
||||||
BRegion screenReg(GetRootLayer()->Bounds());
|
BRegion screenReg(GetRootLayer()->Bounds());
|
||||||
|
|
||||||
reg.IntersectWith(&screenReg);
|
reg.IntersectWith(&screenReg);
|
||||||
}
|
}
|
||||||
@@ -792,7 +792,7 @@ if (cnt != 1)
|
|||||||
msg.what = _UPDATE_;
|
msg.what = _UPDATE_;
|
||||||
|
|
||||||
BRect rect(fInUpdateRegion.Frame());
|
BRect rect(fInUpdateRegion.Frame());
|
||||||
ConvertFromScreen2(&rect);
|
ConvertFromScreen(&rect);
|
||||||
msg.AddRect("_rect", rect );
|
msg.AddRect("_rect", rect );
|
||||||
msg.AddRect("debug_rect", fInUpdateRegion.Frame());
|
msg.AddRect("debug_rect", fInUpdateRegion.Frame());
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ class WinBorder : public Layer {
|
|||||||
void UpdateFont();
|
void UpdateFont();
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
|
|
||||||
virtual bool HasClient() { return false; }
|
|
||||||
inline Decorator* GetDecorator() const { return fDecorator; }
|
inline Decorator* GetDecorator() const { return fDecorator; }
|
||||||
|
|
||||||
inline int32 Look() const { return fLook; }
|
inline int32 Look() const { return fLook; }
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ WorkspacesLayer::_WorkspaceAt(int32 i)
|
|||||||
int32 columns, rows;
|
int32 columns, rows;
|
||||||
_GetGrid(columns, rows);
|
_GetGrid(columns, rows);
|
||||||
|
|
||||||
int32 width = fFrame.IntegerWidth() / columns;
|
int32 width = Frame().IntegerWidth() / columns;
|
||||||
int32 height = fFrame.IntegerHeight() / rows;
|
int32 height = Frame().IntegerHeight() / rows;
|
||||||
|
|
||||||
int32 column = i % columns;
|
int32 column = i % columns;
|
||||||
int32 row = i / columns;
|
int32 row = i / columns;
|
||||||
@@ -62,11 +62,13 @@ WorkspacesLayer::_WorkspaceAt(int32 i)
|
|||||||
|
|
||||||
// make sure there is no gap anywhere
|
// make sure there is no gap anywhere
|
||||||
if (column == columns - 1)
|
if (column == columns - 1)
|
||||||
rect.right = fFrame.right;
|
rect.right = Frame().right;
|
||||||
if (row == rows - 1)
|
if (row == rows - 1)
|
||||||
rect.bottom = fFrame.bottom;
|
rect.bottom = Frame().bottom;
|
||||||
|
|
||||||
rect.OffsetBy(ConvertToTop(BPoint(0, 0)));
|
BPoint pt(0,0);
|
||||||
|
ConvertToScreen(&pt);
|
||||||
|
rect.OffsetBy(pt);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +126,12 @@ WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
|
|||||||
backgroundRegion.Exclude(tabFrame);
|
backgroundRegion.Exclude(tabFrame);
|
||||||
backgroundRegion.Exclude(frame);
|
backgroundRegion.Exclude(frame);
|
||||||
|
|
||||||
fDriver->StrokeLine(tabFrame.LeftTop(), tabFrame.RightBottom(), yellow);
|
GetDrawingEngine()->StrokeLine(tabFrame.LeftTop(), tabFrame.RightBottom(), yellow);
|
||||||
|
|
||||||
fDriver->StrokeRect(frame, gray);
|
GetDrawingEngine()->StrokeRect(frame, gray);
|
||||||
|
|
||||||
frame.InsetBy(1, 1);
|
frame.InsetBy(1, 1);
|
||||||
fDriver->FillRect(frame, white);
|
GetDrawingEngine()->FillRect(frame, white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -143,7 +145,7 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
|||||||
if (active) {
|
if (active) {
|
||||||
// draw active frame
|
// draw active frame
|
||||||
RGBColor black(0, 0, 0);
|
RGBColor black(0, 0, 0);
|
||||||
fDriver->StrokeRect(rect, black);
|
GetDrawingEngine()->StrokeRect(rect, black);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw background
|
// draw background
|
||||||
@@ -181,19 +183,19 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
|||||||
|
|
||||||
BRegion workspaceRegion(rect);
|
BRegion workspaceRegion(rect);
|
||||||
backgroundRegion.IntersectWith(&workspaceRegion);
|
backgroundRegion.IntersectWith(&workspaceRegion);
|
||||||
fDriver->ConstrainClippingRegion(&backgroundRegion);
|
GetDrawingEngine()->ConstrainClippingRegion(&backgroundRegion);
|
||||||
|
|
||||||
for (int32 i = count; i-- > 0;) {
|
for (int32 i = count; i-- > 0;) {
|
||||||
_DrawWindow(rect, screenFrame, windows[i], backgroundRegion, active);
|
_DrawWindow(rect, screenFrame, windows[i], backgroundRegion, active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fDriver->ConstrainClippingRegion(&backgroundRegion);
|
GetDrawingEngine()->ConstrainClippingRegion(&backgroundRegion);
|
||||||
fDriver->FillRect(rect, color);
|
GetDrawingEngine()->FillRect(rect, color);
|
||||||
|
|
||||||
// TODO: ConstrainClippingRegion() should accept a const parameter !!
|
// TODO: ConstrainClippingRegion() should accept a const parameter !!
|
||||||
BRegion cRegion(VisibleRegion());
|
BRegion cRegion(VisibleRegion());
|
||||||
fDriver->ConstrainClippingRegion(&cRegion);
|
GetDrawingEngine()->ConstrainClippingRegion(&cRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -215,26 +217,28 @@ WorkspacesLayer::Draw(const BRect& updateRect)
|
|||||||
// draw grid
|
// draw grid
|
||||||
// horizontal lines
|
// horizontal lines
|
||||||
|
|
||||||
BRect frame = fFrame;
|
BRect frame = Frame();
|
||||||
frame.OffsetBy(ConvertToTop(BPoint(0, 0)));
|
BPoint pt(0,0);
|
||||||
|
ConvertToScreen(&pt);
|
||||||
|
frame.OffsetBy(pt);
|
||||||
|
|
||||||
fDriver->StrokeLine(BPoint(frame.left, frame.top),
|
GetDrawingEngine()->StrokeLine(BPoint(frame.left, frame.top),
|
||||||
BPoint(frame.right, frame.top), ViewColor());
|
BPoint(frame.right, frame.top), ViewColor());
|
||||||
|
|
||||||
for (int32 row = 0; row < rows; row++) {
|
for (int32 row = 0; row < rows; row++) {
|
||||||
BRect rect = _WorkspaceAt(row * columns);
|
BRect rect = _WorkspaceAt(row * columns);
|
||||||
fDriver->StrokeLine(BPoint(frame.left, rect.bottom),
|
GetDrawingEngine()->StrokeLine(BPoint(frame.left, rect.bottom),
|
||||||
BPoint(frame.right, rect.bottom), ViewColor());
|
BPoint(frame.right, rect.bottom), ViewColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// vertical lines
|
// vertical lines
|
||||||
|
|
||||||
fDriver->StrokeLine(BPoint(frame.left, frame.top),
|
GetDrawingEngine()->StrokeLine(BPoint(frame.left, frame.top),
|
||||||
BPoint(frame.left, frame.bottom), ViewColor());
|
BPoint(frame.left, frame.bottom), ViewColor());
|
||||||
|
|
||||||
for (int32 column = 0; column < columns; column++) {
|
for (int32 column = 0; column < columns; column++) {
|
||||||
BRect rect = _WorkspaceAt(column);
|
BRect rect = _WorkspaceAt(column);
|
||||||
fDriver->StrokeLine(BPoint(rect.right, frame.top),
|
GetDrawingEngine()->StrokeLine(BPoint(rect.right, frame.top),
|
||||||
BPoint(rect.right, frame.bottom), ViewColor());
|
BPoint(rect.right, frame.bottom), ViewColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user