Implemented drawing of pictures inside pictures. Thanks to Marc

Flerackers for clarifying some things.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-13 09:19:30 +00:00
parent ac5fdd8a6d
commit edac8f06a8
3 changed files with 16 additions and 4 deletions

View File

@ -2675,7 +2675,7 @@ ServerApp::CreatePicture(const ServerPicture *original)
ServerPicture *
ServerApp::FindPicture(const int32 &token) const
{
// TODO: we need to make sure the picture is ours?!
// TODO: we need to make sure the picture is ours?!
ServerPicture* picture;
if (gTokenSpace.GetToken(token, kPictureToken, (void**)&picture) == B_OK)
return picture;

View File

@ -777,7 +777,12 @@ ServerPicture::~ServerPicture()
{
delete fData;
gTokenSpace.RemoveToken(fToken);
delete fPictures;
if (fPictures != NULL) {
for (int32 i = fPictures->CountItems() - 1; i >= 0; i--)
delete static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
delete fPictures;
}
}

View File

@ -2674,7 +2674,15 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
if (link.Read<int32>(&token) == B_OK) {
BPoint where;
link.Read<BPoint>(&where);
picture->WriteDrawPicture(where, token);
ServerPicture *pictureToDraw = App()->FindPicture(token);
if (picture != NULL) {
// We need to make a copy of the picture, since it can change
// after it has been drawn
ServerPicture *copy = App()->CreatePicture(pictureToDraw);
picture->NestPicture(copy);
picture->WriteDrawPicture(where, copy->Token());
}
}
break;
}
@ -2695,7 +2703,6 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
if (!steppedDown)
return false;
steppedDown->NestPicture(picture);
fCurrentLayer->SetPicture(steppedDown);
fLink.StartMessage(B_OK);
fLink.Attach<int32>(picture->Token());