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);
|
void MakeBottomChild(void);
|
||||||
Layer *FindLayer(int32 token);
|
Layer *FindLayer(int32 token);
|
||||||
Layer *GetChildAt(BPoint pt, bool recursive=false);
|
Layer *GetChildAt(BPoint pt, bool recursive=false);
|
||||||
|
Layer *GetUpperSibling() { return _uppersibling; }
|
||||||
|
Layer *GetLowerSibling() { return _lowersibling; }
|
||||||
PortLink *GetLink(void);
|
PortLink *GetLink(void);
|
||||||
const char *GetName(void) { return (_name)?_name->String():NULL; }
|
const char *GetName(void) { return (_name)?_name->String():NULL; }
|
||||||
LayerData *GetLayerData(void) { return _layerdata; }
|
LayerData *GetLayerData(void) { return _layerdata; }
|
||||||
|
@ -634,19 +634,42 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|||||||
int32 code;
|
int32 code;
|
||||||
int32 view_token;
|
int32 view_token;
|
||||||
uint32 sizeRemaining = (uint32)msgsize;
|
uint32 sizeRemaining = (uint32)msgsize;
|
||||||
|
BRegion WindowClipRegion;
|
||||||
|
BRegion LayerClipRegion;
|
||||||
|
Layer *sibling;
|
||||||
|
int32 numRects;
|
||||||
|
|
||||||
if ( !msgsize || !msgbuffer )
|
if ( !msgsize || !msgbuffer )
|
||||||
return;
|
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.
|
// We need to decide whether coordinates are specified in view or root coordinates.
|
||||||
// For now, we assume root level 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);
|
code = read_from_buffer<int32>(&msgbuffer);
|
||||||
view_token = read_from_buffer<int32>(&msgbuffer);
|
view_token = read_from_buffer<int32>(&msgbuffer);
|
||||||
layer = _workspace->GetRoot()->FindLayer(view_token);
|
layer = _workspace->GetRoot()->FindLayer(view_token);
|
||||||
if ( layer )
|
if ( layer )
|
||||||
|
{
|
||||||
layerdata = layer->GetLayerData();
|
layerdata = layer->GetLayerData();
|
||||||
|
LayerClipRegion.Set(layer->Frame());
|
||||||
|
LayerClipRegion.IntersectWith(&WindowClipRegion);
|
||||||
|
numRects = LayerClipRegion.CountRects();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
layerdata = NULL;
|
layerdata = NULL;
|
||||||
@ -999,7 +1022,6 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|||||||
}
|
}
|
||||||
case AS_FILL_RECT:
|
case AS_FILL_RECT:
|
||||||
{
|
{
|
||||||
// TODO:: Add clipping
|
|
||||||
if ( sizeRemaining >= AS_FILL_RECT_MSG_SIZE )
|
if ( sizeRemaining >= AS_FILL_RECT_MSG_SIZE )
|
||||||
{
|
{
|
||||||
float left, top, right, bottom;
|
float left, top, right, bottom;
|
||||||
@ -1010,8 +1032,15 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|||||||
bottom = read_from_buffer<float>(&msgbuffer);
|
bottom = read_from_buffer<float>(&msgbuffer);
|
||||||
pattern = read_pattern_from_buffer(&msgbuffer);
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
||||||
BRect rect(left,top,right,bottom);
|
BRect rect(left,top,right,bottom);
|
||||||
if ( layerdata )
|
if ( layerdata && numRects )
|
||||||
|
if ( numRects == 1 )
|
||||||
_app->_driver->FillRect(rect,layerdata,pattern);
|
_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;
|
sizeRemaining -= AS_FILL_RECT_MSG_SIZE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user