Added support for sending BRegions
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10943 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2a8a80a764
commit
27c5631fa3
@ -67,6 +67,7 @@ public:
|
||||
|
||||
status_t Attach(const void *data, ssize_t size);
|
||||
status_t AttachString(const char *string);
|
||||
status_t AttachRegion(const BRegion ®ion);
|
||||
template <class Type> status_t Attach(const Type& data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
@ -75,6 +76,7 @@ public:
|
||||
status_t GetNextReply(int32 *code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
status_t ReadRegion(BRegion *region);
|
||||
template <class T> status_t Read(T *data)
|
||||
{
|
||||
return fReader->Read(data,sizeof(T));
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
#include <Region.h>
|
||||
|
||||
#include <ServerProtocol.h>
|
||||
#include <PortLink.h>
|
||||
@ -106,3 +107,18 @@ status_t BPortLink::AttachString(const char *string)
|
||||
{
|
||||
return fSender->AttachString(string);
|
||||
}
|
||||
|
||||
status_t BPortLink::ReadRegion(BRegion *region)
|
||||
{
|
||||
fReader->Read(®ion->count, sizeof(long));
|
||||
fReader->Read(®ion->bound, sizeof(clipping_rect));
|
||||
region->set_size(region->count + 1);
|
||||
return fReader->Read(region->data, region->count * sizeof(clipping_rect));
|
||||
}
|
||||
|
||||
status_t BPortLink::AttachRegion(const BRegion ®ion)
|
||||
{
|
||||
fSender->Attach(®ion.count, sizeof(long));
|
||||
fSender->Attach(®ion.bound, sizeof(clipping_rect));
|
||||
return fSender->Attach(region.data, region.count * sizeof(clipping_rect));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user