diff --git a/src/servers/app/server/DisplayDriver.cpp b/src/servers/app/server/DisplayDriver.cpp index 9abc260182..4e674ce518 100644 --- a/src/servers/app/server/DisplayDriver.cpp +++ b/src/servers/app/server/DisplayDriver.cpp @@ -204,6 +204,26 @@ void DisplayDriver::FillRect(BRect r, LayerData *d, int8 *pat) { } +/*! + \brief Convenience function for server use + \param r BRegion to be filled + \param d Data structure containing any other data necessary for the call. Always non-NULL. + \param pat 8-byte array containing the pattern to use. Always non-NULL. + +*/ +void DisplayDriver::FillRegion(BRegion *r, LayerData *d, int8 *pat) +{ + if(!r || !d || !pat) + return; + + _locker->Lock(); + + for(int32 i=0; iCountRects();i++) + FillRect(r->RectAt(i),d,pat); + + _locker->Unlock(); +} + /*! \brief Called for all BView::FillRoundRect calls \param r The rectangle itself @@ -419,6 +439,26 @@ void DisplayDriver::StrokeRect(BRect r, LayerData *d, int8 *pat) { } +/*! + \brief Convenience function for server use + \param r BRegion to be stroked + \param d Data structure containing any other data necessary for the call. Always non-NULL. + \param pat 8-byte array containing the pattern to use. Always non-NULL. + +*/ +void DisplayDriver::StrokeRegion(BRegion *r, LayerData *d, int8 *pat) +{ + if(!r || !d || !pat) + return; + + _locker->Lock(); + + for(int32 i=0; iCountRects();i++) + StrokeRect(r->RectAt(i),d,pat); + + _locker->Unlock(); +} + /*! \brief Called for all BView::StrokeRoundRect calls \param r The rect itself diff --git a/src/servers/app/server/DisplayDriver.h b/src/servers/app/server/DisplayDriver.h index aea8ef982b..01e60978f3 100644 --- a/src/servers/app/server/DisplayDriver.h +++ b/src/servers/app/server/DisplayDriver.h @@ -36,6 +36,7 @@ #include #include #include "RGBColor.h" +#include class ServerCursor; class ServerBitmap; @@ -106,6 +107,7 @@ public: virtual void FillEllipse(BRect r, LayerData *d, int8 *pat); virtual void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat); virtual void FillRect(BRect r, LayerData *d, int8 *pat); + virtual void FillRegion(BRegion *r, LayerData *d, int8 *pat); virtual void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat); // virtual void FillShape(SShape *sh, LayerData *d, int8 *pat); virtual void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat); @@ -124,6 +126,7 @@ public: virtual void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat); virtual void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true); virtual void StrokeRect(BRect r, LayerData *d, int8 *pat); + virtual void StrokeRegion(BRegion *r, LayerData *d, int8 *pat); virtual void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat); // virtual void StrokeShape(SShape *sh, LayerData *d, int8 *pat); virtual void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat); diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index 7d8c359b67..b7f3355d66 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -36,6 +36,12 @@ #include "RectUtils.h" //#define DEBUG_LAYER +#define DEBUG_REGIONS + +#ifdef DEBUG_REGIONS +#include "Desktop.h" +#include "DisplayDriver.h" +#endif //! TokenHandler object used to provide IDs for all Layers and, thus, BViews TokenHandler view_token_handler; @@ -685,12 +691,20 @@ printf("Layer: %s: Move By (%.1f,%.1f)\n",_name->String(),x,y); if(_parent) { - if(_parent->_invalid==NULL) - _parent->_invalid=new BRegion(oldframe); - else - _parent->_invalid->Include(oldframe); - } + BRegion *i=new BRegion(oldframe); + if(TestRectIntersection(oldframe,_frame)) + i->Exclude(_frame); + if(_parent->_invalid==NULL) + _parent->_invalid=i; + else + { + _parent->_invalid->Include(i); + delete i; + } + _parent->_is_dirty=true; + } + _is_dirty=true; // for(Layer *lay=_topchild; lay!=NULL; lay=lay->_lowersibling) // lay->MoveBy(x,y); // Invalidate(Frame()); @@ -752,18 +766,16 @@ printf("Layer: %s: Rebuild Regions (%s)\n",_name->String(),include_children?"inc { if(childlay->_visible && childlay->_hidecount==0) { - // reg is what is _visible in the layer's _parent's coordinate system -// reg=new BRegion(ConvertToParent(_visible)); - // reg2 is the layer's _visible region in the sibling's coordinate system -// reg2=new BRegion(childlay->ConvertFromParent(reg)); -// delete reg; - - // lowersiblings occupy screen space _above_ a layer, so the layer itself - // must remove from its _visible region -// _visible->Exclude(reg2); -// delete reg2; - reg=new BRegion(ConvertToParent(_visible)); +#ifdef DEBUG_REGIONS +printf("old visible:");_visible->PrintToStream(); +#endif + reg=new BRegion(childlay->ConvertToParent(childlay->_visible)); _visible->Exclude(reg); +#ifdef DEBUG_REGIONS +printf("child visible:");childlay->_visible->PrintToStream(); +printf("converted child visible:");reg->PrintToStream(); +printf("new visible:");_visible->PrintToStream(); +#endif delete reg; } } diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index 11676b4354..0b2f5894c2 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -296,11 +296,6 @@ printf("ClickMove: Drag\n"); _win->Unlock(); lock_layers(); -// _parent->Invalidate(oldmoveframe); -// MoveBy(dx,dy); -// _decorator->MoveBy(BPoint(dx, dy)); -// _parent->RequestDraw(); -// _decorator->Draw(); BRegion *reg=_decorator->GetFootprint(); _driver->CopyRegion(reg,_win->_frame.LeftTop());