Implemented BPrivateScreen::ReadBitmap(), but the guts are still missing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-07-13 22:33:52 +00:00
parent 9b7ed7eb1f
commit 16046321cc
4 changed files with 53 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include <InterfaceDefs.h>
#include <Rect.h>
class BPrivateScreen;
class BWindow;
enum {
@ -92,7 +93,8 @@ public:
private:
friend class BView;
friend class BApplication;
friend void _get_screen_bitmap_(BBitmap *, BRect, bool);
friend class BPrivateScreen;
//friend void _get_screen_bitmap_(BBitmap *, BRect, bool);
virtual void _ReservedBitmap1();
virtual void _ReservedBitmap2();

View File

@ -150,6 +150,8 @@ enum {
AS_GET_DESKTOP_COLOR,
AS_SET_DESKTOP_COLOR,
AS_READ_BITMAP,
AS_GET_RETRACE_SEMAPHORE,
AS_GET_ACCELERANT_INFO,

View File

@ -24,6 +24,7 @@
// Description: BPrivateScreen is the class which does the real work
// for the proxy class BScreen (it interacts with the app server).
//------------------------------------------------------------------------------
#include <Bitmap.h>
#include <Locker.h>
#include <Window.h>
@ -198,6 +199,9 @@ BPrivateScreen::ColorMap()
status_t
BPrivateScreen::GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound)
{
if (bitmap == NULL)
return B_BAD_VALUE;
// TODO: Implement
return B_ERROR;
}
@ -206,8 +210,26 @@ BPrivateScreen::GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound)
status_t
BPrivateScreen::ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound)
{
// TODO: Implement
return B_ERROR;
if (bitmap == NULL)
return B_BAD_VALUE;
BRect rect;
if (bound != NULL)
rect = *bound;
else
rect = Frame();
BPrivate::AppServerLink link;
link.StartMessage(AS_READ_BITMAP);
link.Attach<int32>(bitmap->get_server_token());
link.Attach<bool>(drawCursor);
link.Attach<BRect>(rect);
int32 code;
if (link.FlushWithReply(code) < B_OK || code != SERVER_TRUE)
return B_ERROR;
return B_OK;
}

View File

@ -2159,6 +2159,30 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fLink.Flush();
break;
}
case AS_READ_BITMAP:
{
STRACE(("ServerApp %s: AS_READ_BITMAP\n", Signature()));
int32 bitmapToken;
link.Read<int32>(&bitmapToken);
bool drawCursor = true;
link.Read<bool>(&drawCursor);
BRect bounds;
link.Read<BRect>(&bounds);
ServerBitmap *bitmap = FindBitmap(bitmapToken);
if (bitmap != NULL) {
fLink.StartMessage(SERVER_TRUE);
// TODO: Implement for real
} else
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
break;
}
default:
printf("ServerApp %s received unhandled message code offset %s\n",