From b41356006aef277792571274133e80dce6151be8 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 3 Jan 2006 16:41:00 +0000 Subject: [PATCH] Implement AS_CLONE_PICTURE handler, needed to copy bpictures server side. Not tested yet git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15826 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerApp.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 8d49479658..c3aac5d643 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -736,14 +736,32 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) break; } -#if 0 + case AS_CLONE_PICTURE: { - // TODO: Implement AS_CLONE_PICTURE - STRACE(("ServerApp %s: Clone Picture unimplemented\n", Signature())); + STRACE(("ServerApp %s: Clone Picture\n", Signature())); + int32 token; + ServerPicture *original = NULL; + if (link.Read(&token) == B_OK) + original = FindPicture(token); + + ServerPicture *cloned = NULL; + if (original != NULL) + cloned = CreatePicture(); + + if (cloned != NULL) { + // TODO: I'm not sure that this does a plain copy. + // Check, and, in case, put the stuff in Data() directly + cloned->AddData(original->Data(), original->DataLength()); + fLink.StartMessage(B_OK); + fLink.Attach(cloned->Token()); + } else + fLink.StartMessage(B_ERROR); + + fLink.Flush(); break; } - +#if 0 case AS_DOWNLOAD_PICTURE: { STRACE(("ServerApp %s: Download Picture unimplemented\n", Signature()));