Implemented BPortLink::AttachShape and BPortLink::ReadShape and used them for passing the shapes in AS_GET_GLYPH_SHAPES.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12215 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2005-04-01 07:29:04 +00:00
parent ebf8af66c9
commit c2da902f2e
6 changed files with 42 additions and 45 deletions
+31
View File
@@ -28,6 +28,7 @@
#include <string.h>
#include <new>
#include <Region.h>
#include <Shape.h>
#include <ServerProtocol.h>
#include <PortLink.h>
@@ -122,3 +123,33 @@ status_t BPortLink::AttachRegion(const BRegion &region)
fSender->Attach(&region.bound, sizeof(clipping_rect));
return fSender->Attach(region.data, region.count * sizeof(clipping_rect));
}
status_t BPortLink::ReadShape(BShape *shape)
{
int32 opCount, ptCount;
fReader->Read(&opCount, sizeof(int32));
fReader->Read(&ptCount, sizeof(int32));
uint32 opList[opCount];
fReader->Read(opList, opCount * sizeof(uint32));
BPoint ptList[ptCount];
fReader->Read(ptList, ptCount * sizeof(BPoint));
shape->SetData(opCount, ptCount, opList, ptList);
return B_OK;
}
status_t BPortLink::AttachShape(BShape &shape)
{
int32 opCount, ptCount;
uint32 *opList;
BPoint *ptList;
shape.GetData(&opCount, &ptCount, &opList, &ptList);
fSender->Attach(&opCount, sizeof(int32));
fSender->Attach(&ptCount, sizeof(int32));
fSender->Attach(opList, opCount * sizeof(uint32));
return fSender->Attach(ptList, ptCount * sizeof(BPoint));
}