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:
parent
ac5fdd8a6d
commit
edac8f06a8
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user