Implemented handlers needed for Begin/EndPicture, and a handler for DrawPicture().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15816 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-01-03 12:44:29 +00:00
parent a1a73d28be
commit 1c33148d10
2 changed files with 66 additions and 12 deletions

View File

@ -726,27 +726,37 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
STRACE(("ServerApp %s: Create Picture unimplemented\n", Signature()));
break;
}
#endif
case AS_DELETE_PICTURE:
{
// TODO: Implement AS_DELETE_PICTURE
STRACE(("ServerApp %s: Delete Picture unimplemented\n", Signature()));
STRACE(("ServerApp %s: Delete Picture\n", Signature()));
int32 token;
if (link.Read<int32>(&token) == B_OK)
DeletePicture(token);
break;
}
#if 0
case AS_CLONE_PICTURE:
{
// TODO: Implement AS_CLONE_PICTURE
STRACE(("ServerApp %s: Clone Picture unimplemented\n", Signature()));
break;
}
case AS_DOWNLOAD_PICTURE:
{
// TODO; Implement AS_DOWNLOAD_PICTURE
STRACE(("ServerApp %s: Download Picture unimplemented\n", Signature()));
int32 token;
link.Read<int32>(&token);
ServerPicture *picture = App()->FindPicture(token);
if (picture != NULL) {
link.StartMessage(B_OK);
} else
link.StartMessage(B_ERROR);
// What is this particular function call for, anyway?
link.Flush();
// DW: I think originally it might have been to support
// the undocumented Flatten function.
break;
}
#endif
@ -2546,7 +2556,8 @@ ServerApp::CreatePicture(int32 *token)
fPictureList.AddItem(picture);
if (token != NULL)
*token = picture->Token();
}
}
return picture;
}

View File

@ -2155,17 +2155,60 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
free(string);
break;
}
#if 0
case AS_LAYER_BEGIN_PICTURE:
CRITICAL("AS_LAYER_BEGIN_PICTURE not implemented\n");
{
DTRACE(("ServerWindow %s: Message AS_LAYER_BEGIN_PICTURE\n", Title()));
ServerPicture *picture = App()->CreatePicture();
fCurrentLayer->SetPicture(picture);
break;
}
case AS_LAYER_APPEND_TO_PICTURE:
CRITICAL("AS_LAYER_APPEND_TO_PICTURE not implemented\n");
{
DTRACE(("ServerWindow %s: Message AS_LAYER_APPEND_TO_PICTURE\n", Title()));
int32 pictureToken;
link.Read<int32>(&pictureToken);
fCurrentLayer->SetPicture(App()->FindPicture(pictureToken));
// we don't care if it's NULL
break;
}
case AS_LAYER_END_PICTURE:
CRITICAL("AS_LAYER_END_PICTURE not implemented\n");
{
DTRACE(("ServerWindow %s: Message AS_LAYER_END_PICTURE\n", Title()));
ServerPicture *picture = fCurrentLayer->Picture();
if (picture != NULL) {
fCurrentLayer->SetPicture(NULL);
fLink.StartMessage(B_OK);
fLink.Attach<int32>(picture->Token());
} else
fLink.StartMessage(B_ERROR);
fLink.Flush();
break;
#endif
}
case AS_LAYER_DRAW_PICTURE:
{
int32 token;
if (link.Read<int32>(&token) == B_OK) {
BPoint where;
link.Read<BPoint>(&where);
ServerPicture *picture = App()->FindPicture(token);
if (picture != NULL) {
fCurrentLayer->ConvertToScreenForDrawing(&where);
fCurrentLayer->CurrentState()->SetPenLocation(where);
picture->Play(fCurrentLayer);
}
}
break;
}
default:
printf("ServerWindow %s received unexpected code - message offset %ld\n",
Title(), code - B_OK);