Also upload/download subpictures

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21926 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-13 14:52:02 +00:00
parent 690c7474a4
commit 38daa5cd6e
3 changed files with 20 additions and 11 deletions

View File

@ -694,9 +694,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
STRACE(("ServerApp %s: Create Picture\n", Signature()));
status_t status = B_ERROR;
ServerPicture *picture = CreatePicture();
if (picture != NULL)
if (picture != NULL) {
int32 subPicturesCount = 0;
link.Read<int32>(&subPicturesCount);
for (int32 c = 0; c < subPicturesCount; c++) {
int32 token = -1;
link.Read<int32>(&token);
if (ServerPicture *subPicture = FindPicture(token))
picture->NestPicture(subPicture);
}
status = picture->ImportData(link);
}
if (status == B_OK) {
fLink.StartMessage(B_OK);
fLink.Attach<int32>(picture->Token());

View File

@ -178,7 +178,6 @@ nop()
static void
move_pen_by(ViewLayer *view, BPoint delta)
{
// view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation()); ?!?
view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta);
}
@ -876,13 +875,7 @@ ServerPicture::DataLength() const
status_t
ServerPicture::ImportData(BPrivate::LinkReceiver &link)
{
int32 subPicturesCount = 0;
link.Read<int32>(&subPicturesCount);
for (int32 c = 0; c < subPicturesCount; c++) {
// TODO: Support nested pictures
}
{
int32 size = 0;
link.Read<int32>(&size);
@ -919,7 +912,15 @@ ServerPicture::ExportData(BPrivate::PortLink &link)
fData->Seek(0, SEEK_SET);
int32 subPicturesCount = 0;
if (fPictures != NULL)
subPicturesCount = fPictures->CountItems();
link.Attach<int32>(subPicturesCount);
if (subPicturesCount > 0) {
for (int32 i = 0; i < subPicturesCount; i++) {
ServerPicture *subPic = static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
link.Attach<int32>(subPic->Token());
}
}
off_t size = 0;
fData->GetSize(&size);

View File

@ -2711,7 +2711,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<int32>(&pictureToken);
ServerPicture *appendPicture = App()->FindPicture(pictureToken);
if (appendPicture) {
picture->SyncState(fCurrentLayer);
//picture->SyncState(fCurrentLayer);
appendPicture->Usurp(picture);
}
fCurrentLayer->SetPicture(appendPicture);