From 16046321cc1ea02071b973c61d782755883bc9ea Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 13 Jul 2005 22:33:52 +0000 Subject: [PATCH] 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 --- headers/os/interface/Bitmap.h | 4 +++- headers/private/app/ServerProtocol.h | 2 ++ src/kits/interface/PrivateScreen.cpp | 26 ++++++++++++++++++++++++-- src/servers/app/ServerApp.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/headers/os/interface/Bitmap.h b/headers/os/interface/Bitmap.h index e41f71a1f5..84f7de0a36 100644 --- a/headers/os/interface/Bitmap.h +++ b/headers/os/interface/Bitmap.h @@ -16,6 +16,7 @@ #include #include +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(); diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h index fd190a360a..8702a9c9fa 100644 --- a/headers/private/app/ServerProtocol.h +++ b/headers/private/app/ServerProtocol.h @@ -150,6 +150,8 @@ enum { AS_GET_DESKTOP_COLOR, AS_SET_DESKTOP_COLOR, + AS_READ_BITMAP, + AS_GET_RETRACE_SEMAPHORE, AS_GET_ACCELERANT_INFO, diff --git a/src/kits/interface/PrivateScreen.cpp b/src/kits/interface/PrivateScreen.cpp index e400f12b97..033d96c555 100644 --- a/src/kits/interface/PrivateScreen.cpp +++ b/src/kits/interface/PrivateScreen.cpp @@ -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 #include #include @@ -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(bitmap->get_server_token()); + link.Attach(drawCursor); + link.Attach(rect); + + int32 code; + if (link.FlushWithReply(code) < B_OK || code != SERVER_TRUE) + return B_ERROR; + + return B_OK; } diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 7c779ff452..66fe27c3c4 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -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(&bitmapToken); + + bool drawCursor = true; + link.Read(&drawCursor); + + BRect bounds; + link.Read(&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",