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:
@@ -2675,7 +2675,7 @@ ServerApp::CreatePicture(const ServerPicture *original)
|
|||||||
ServerPicture *
|
ServerPicture *
|
||||||
ServerApp::FindPicture(const int32 &token) const
|
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;
|
ServerPicture* picture;
|
||||||
if (gTokenSpace.GetToken(token, kPictureToken, (void**)&picture) == B_OK)
|
if (gTokenSpace.GetToken(token, kPictureToken, (void**)&picture) == B_OK)
|
||||||
return picture;
|
return picture;
|
||||||
|
|||||||
@@ -777,7 +777,12 @@ ServerPicture::~ServerPicture()
|
|||||||
{
|
{
|
||||||
delete fData;
|
delete fData;
|
||||||
gTokenSpace.RemoveToken(fToken);
|
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) {
|
if (link.Read<int32>(&token) == B_OK) {
|
||||||
BPoint where;
|
BPoint where;
|
||||||
link.Read<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;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2695,7 +2703,6 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
if (!steppedDown)
|
if (!steppedDown)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
steppedDown->NestPicture(picture);
|
|
||||||
fCurrentLayer->SetPicture(steppedDown);
|
fCurrentLayer->SetPicture(steppedDown);
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<int32>(picture->Token());
|
fLink.Attach<int32>(picture->Token());
|
||||||
|
|||||||
Reference in New Issue
Block a user