Begin adding clipping to graphics message processing.
Add sibling access functions to layers. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3912 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f029162a70
commit
64150e75b5
@ -64,6 +64,8 @@ public:
|
||||
void MakeBottomChild(void);
|
||||
Layer *FindLayer(int32 token);
|
||||
Layer *GetChildAt(BPoint pt, bool recursive=false);
|
||||
Layer *GetUpperSibling() { return _uppersibling; }
|
||||
Layer *GetLowerSibling() { return _lowersibling; }
|
||||
PortLink *GetLink(void);
|
||||
const char *GetName(void) { return (_name)?_name->String():NULL; }
|
||||
LayerData *GetLayerData(void) { return _layerdata; }
|
||||
|
@ -634,19 +634,42 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
||||
int32 code;
|
||||
int32 view_token;
|
||||
uint32 sizeRemaining = (uint32)msgsize;
|
||||
BRegion WindowClipRegion;
|
||||
BRegion LayerClipRegion;
|
||||
Layer *sibling;
|
||||
int32 numRects;
|
||||
|
||||
if ( !msgsize || !msgbuffer )
|
||||
return;
|
||||
if ( IsHidden() )
|
||||
return;
|
||||
|
||||
WindowClipRegion.Set(_winborder->Frame());
|
||||
sibling = _winborder->GetUpperSibling();
|
||||
while ( sibling )
|
||||
{
|
||||
WindowClipRegion.Exclude(sibling->Frame());
|
||||
sibling = sibling->GetUpperSibling();
|
||||
}
|
||||
|
||||
if ( !WindowClipRegion.Frame().IsValid() )
|
||||
return;
|
||||
|
||||
// We need to decide whether coordinates are specified in view or root coordinates.
|
||||
// For now, we assume root level coordinates.
|
||||
while (sizeRemaining > 2*sizeof(int32))
|
||||
code = AS_BEGIN_UPDATE;
|
||||
while ((sizeRemaining > 2*sizeof(int32)) && (code != AS_END_UPDATE))
|
||||
{
|
||||
code = read_from_buffer<int32>(&msgbuffer);
|
||||
view_token = read_from_buffer<int32>(&msgbuffer);
|
||||
layer = _workspace->GetRoot()->FindLayer(view_token);
|
||||
if ( layer )
|
||||
{
|
||||
layerdata = layer->GetLayerData();
|
||||
LayerClipRegion.Set(layer->Frame());
|
||||
LayerClipRegion.IntersectWith(&WindowClipRegion);
|
||||
numRects = LayerClipRegion.CountRects();
|
||||
}
|
||||
else
|
||||
{
|
||||
layerdata = NULL;
|
||||
@ -999,7 +1022,6 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
||||
}
|
||||
case AS_FILL_RECT:
|
||||
{
|
||||
// TODO:: Add clipping
|
||||
if ( sizeRemaining >= AS_FILL_RECT_MSG_SIZE )
|
||||
{
|
||||
float left, top, right, bottom;
|
||||
@ -1010,8 +1032,15 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
||||
bottom = read_from_buffer<float>(&msgbuffer);
|
||||
pattern = read_pattern_from_buffer(&msgbuffer);
|
||||
BRect rect(left,top,right,bottom);
|
||||
if ( layerdata )
|
||||
_app->_driver->FillRect(rect,layerdata,pattern);
|
||||
if ( layerdata && numRects )
|
||||
if ( numRects == 1 )
|
||||
_app->_driver->FillRect(rect,layerdata,pattern);
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<numRects; i++)
|
||||
_app->_driver->FillRect(LayerClipRegion.RectAt(i),layerdata,pattern);
|
||||
}
|
||||
sizeRemaining -= AS_FILL_RECT_MSG_SIZE;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user