Implemented BPicture's SetPenLocation() op, also nested
AppendToPicture() (but still doesn't work :( ). Moved some functions around in PictureDataWriter.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,37 +23,17 @@ public:
|
|||||||
|
|
||||||
status_t SetTo(BPositionIO *data);
|
status_t SetTo(BPositionIO *data);
|
||||||
|
|
||||||
|
status_t WriteSetHighColor(const rgb_color &color);
|
||||||
|
status_t WriteSetLowColor(const rgb_color &color);
|
||||||
status_t WriteSetOrigin(const BPoint &point);
|
status_t WriteSetOrigin(const BPoint &point);
|
||||||
status_t WriteInvertRect(const BRect &rect);
|
|
||||||
|
|
||||||
status_t WriteSetDrawingMode(const drawing_mode &mode);
|
status_t WriteSetDrawingMode(const drawing_mode &mode);
|
||||||
|
status_t WriteSetPenLocation(const BPoint &point);
|
||||||
status_t WriteSetPenSize(const float &penSize);
|
status_t WriteSetPenSize(const float &penSize);
|
||||||
status_t WriteSetLineMode(const cap_mode &cap, const join_mode &join, const float &miterLimit);
|
status_t WriteSetLineMode(const cap_mode &cap, const join_mode &join, const float &miterLimit);
|
||||||
status_t WriteSetScale(const float &scale);
|
status_t WriteSetScale(const float &scale);
|
||||||
|
|
||||||
status_t WriteDrawRect(const BRect &rect, const bool &fill);
|
status_t WritePushState();
|
||||||
status_t WriteDrawRoundRect(const BRect &rect, const BPoint &radius, const bool &fill);
|
status_t WritePopState();
|
||||||
status_t WriteDrawEllipse(const BRect &rect, const bool &fill);
|
|
||||||
status_t WriteDrawArc(const BPoint ¢er, const BPoint &radius,
|
|
||||||
const float &startTheta, const float &arcTheta, const bool &fill);
|
|
||||||
status_t WriteDrawPolygon(const int32 &numPoints, BPoint *points,
|
|
||||||
const bool &isClosed, const bool &fill);
|
|
||||||
status_t WriteDrawBezier(const BPoint points[4], const bool &fill);
|
|
||||||
|
|
||||||
status_t WriteStrokeLine(const BPoint &start, const BPoint &end);
|
|
||||||
|
|
||||||
status_t WriteSetHighColor(const rgb_color &color);
|
|
||||||
status_t WriteSetLowColor(const rgb_color &color);
|
|
||||||
|
|
||||||
status_t WriteDrawString(const BPoint &where, const char *string,
|
|
||||||
const int32 &length, const escapement_delta &delta);
|
|
||||||
status_t WriteDrawShape(const int32 &opCount, const void *opList,
|
|
||||||
const int32 &ptCount, const void *ptList, const bool &fill);
|
|
||||||
status_t WriteDrawBitmap(const BRect &srcRect, const BRect &dstRect, const int32 &width, const int32 &height,
|
|
||||||
const int32 &bytesPerRow, const int32 &colorSpace, const int32 &flags,
|
|
||||||
const void *data, const int32 &length);
|
|
||||||
|
|
||||||
status_t WriteDrawPicture(const BPoint &where, const int32 &token);
|
|
||||||
|
|
||||||
status_t WriteSetFontFamily(const font_family &family);
|
status_t WriteSetFontFamily(const font_family &family);
|
||||||
status_t WriteSetFontStyle(const font_style &style);
|
status_t WriteSetFontStyle(const font_style &style);
|
||||||
@@ -65,9 +45,25 @@ public:
|
|||||||
status_t WriteSetFontShear(const int32 &shear);
|
status_t WriteSetFontShear(const int32 &shear);
|
||||||
status_t WriteSetFontFace(const int32 &face);
|
status_t WriteSetFontFace(const int32 &face);
|
||||||
|
|
||||||
status_t WritePushState();
|
status_t WriteStrokeLine(const BPoint &start, const BPoint &end);
|
||||||
status_t WritePopState();
|
status_t WriteInvertRect(const BRect &rect);
|
||||||
|
status_t WriteDrawRect(const BRect &rect, const bool &fill);
|
||||||
|
status_t WriteDrawRoundRect(const BRect &rect, const BPoint &radius, const bool &fill);
|
||||||
|
status_t WriteDrawEllipse(const BRect &rect, const bool &fill);
|
||||||
|
status_t WriteDrawArc(const BPoint ¢er, const BPoint &radius,
|
||||||
|
const float &startTheta, const float &arcTheta, const bool &fill);
|
||||||
|
status_t WriteDrawPolygon(const int32 &numPoints, BPoint *points,
|
||||||
|
const bool &isClosed, const bool &fill);
|
||||||
|
status_t WriteDrawBezier(const BPoint points[4], const bool &fill);
|
||||||
|
status_t WriteDrawString(const BPoint &where, const char *string,
|
||||||
|
const int32 &length, const escapement_delta &delta);
|
||||||
|
status_t WriteDrawShape(const int32 &opCount, const void *opList,
|
||||||
|
const int32 &ptCount, const void *ptList, const bool &fill);
|
||||||
|
status_t WriteDrawBitmap(const BRect &srcRect, const BRect &dstRect, const int32 &width, const int32 &height,
|
||||||
|
const int32 &bytesPerRow, const int32 &colorSpace, const int32 &flags,
|
||||||
|
const void *data, const int32 &length);
|
||||||
|
|
||||||
|
status_t WriteDrawPicture(const BPoint &where, const int32 &token);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// throw a status_t on error
|
// throw a status_t on error
|
||||||
|
|||||||
@@ -88,6 +88,20 @@ PictureDataWriter::WriteSetDrawingMode(const drawing_mode &mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
PictureDataWriter::WriteSetPenLocation(const BPoint &point)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
BeginOp(B_PIC_SET_PEN_LOCATION);
|
||||||
|
Write<BPoint>(point);
|
||||||
|
EndOp();
|
||||||
|
} catch (status_t &status) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
PictureDataWriter::WriteSetPenSize(const float &penSize)
|
PictureDataWriter::WriteSetPenSize(const float &penSize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -735,8 +735,6 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
fUsurped(NULL)
|
fUsurped(NULL)
|
||||||
{
|
{
|
||||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
|
||||||
|
|
||||||
BMallocIO *mallocIO = new (std::nothrow) BMallocIO();
|
BMallocIO *mallocIO = new (std::nothrow) BMallocIO();
|
||||||
if (mallocIO == NULL)
|
if (mallocIO == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -747,6 +745,8 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
if (mallocIO->SetSize(size) < B_OK)
|
if (mallocIO->SetSize(size) < B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||||
|
|
||||||
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
||||||
|
|
||||||
PictureDataWriter::SetTo(fData);
|
PictureDataWriter::SetTo(fData);
|
||||||
@@ -790,7 +790,8 @@ ServerPicture::SyncState(ViewLayer *view)
|
|||||||
// TODO: Finish this
|
// TODO: Finish this
|
||||||
BeginOp(B_PIC_ENTER_STATE_CHANGE);
|
BeginOp(B_PIC_ENTER_STATE_CHANGE);
|
||||||
|
|
||||||
// WriteSetPenLocation(view->CurrentState()->PenLocation());
|
WriteSetOrigin(view->CurrentState()->Origin());
|
||||||
|
WriteSetPenLocation(view->CurrentState()->PenLocation());
|
||||||
WriteSetPenSize(view->CurrentState()->PenSize());
|
WriteSetPenSize(view->CurrentState()->PenSize());
|
||||||
WriteSetScale(view->CurrentState()->Scale());
|
WriteSetScale(view->CurrentState()->Scale());
|
||||||
WriteSetLineMode(view->CurrentState()->LineCapMode(), view->CurrentState()->LineJoinMode(),
|
WriteSetLineMode(view->CurrentState()->LineCapMode(), view->CurrentState()->LineJoinMode(),
|
||||||
|
|||||||
@@ -2400,6 +2400,14 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_LAYER_SET_PEN_LOC:
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
link.Read<float>(&x);
|
||||||
|
link.Read<float>(&y);
|
||||||
|
picture->WriteSetPenLocation(BPoint(x, y));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case AS_LAYER_SET_PEN_SIZE:
|
case AS_LAYER_SET_PEN_SIZE:
|
||||||
{
|
{
|
||||||
float penSize;
|
float penSize;
|
||||||
@@ -2697,12 +2705,23 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_LAYER_APPEND_TO_PICTURE:
|
||||||
|
{
|
||||||
|
int32 pictureToken;
|
||||||
|
link.Read<int32>(&pictureToken);
|
||||||
|
ServerPicture *appendPicture = App()->FindPicture(pictureToken);
|
||||||
|
if (appendPicture) {
|
||||||
|
picture->SyncState(fCurrentLayer);
|
||||||
|
appendPicture->Usurp(picture);
|
||||||
|
}
|
||||||
|
fCurrentLayer->SetPicture(appendPicture);
|
||||||
|
// we don't care if it's NULL
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_LAYER_END_PICTURE:
|
case AS_LAYER_END_PICTURE:
|
||||||
{
|
{
|
||||||
ServerPicture *steppedDown = picture->StepDown();
|
ServerPicture *steppedDown = picture->StepDown();
|
||||||
if (!steppedDown)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
fCurrentLayer->SetPicture(steppedDown);
|
fCurrentLayer->SetPicture(steppedDown);
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<int32>(picture->Token());
|
fLink.Attach<int32>(picture->Token());
|
||||||
|
|||||||
Reference in New Issue
Block a user