* use a different message code for DrawString() with escapement delta
and DrawString() without * this change also includes adding the penlocation to the shape to-screem coordinate conversion (temporarily breaks shape rendering, will be fixed in next commit) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c68e76bc26
commit
94a48ae276
@ -213,6 +213,7 @@ enum {
|
||||
AS_FILL_TRIANGLE,
|
||||
|
||||
AS_DRAW_STRING,
|
||||
AS_DRAW_STRING_WITH_DELTA,
|
||||
|
||||
AS_SYNC,
|
||||
|
||||
|
@ -2424,20 +2424,16 @@ BView::DrawString(const char *string, int32 length, BPoint location,
|
||||
if (fOwner) {
|
||||
check_lock();
|
||||
|
||||
fOwner->fLink->StartMessage(AS_DRAW_STRING);
|
||||
// quite often delta will be NULL
|
||||
if (delta)
|
||||
fOwner->fLink->StartMessage(AS_DRAW_STRING_WITH_DELTA);
|
||||
else
|
||||
fOwner->fLink->StartMessage(AS_DRAW_STRING);
|
||||
fOwner->fLink->Attach<int32>(length);
|
||||
fOwner->fLink->Attach<BPoint>(location);
|
||||
|
||||
// Quite often delta will be NULL, so we have to accomodate this.
|
||||
if (delta)
|
||||
fOwner->fLink->Attach<escapement_delta>(*delta);
|
||||
else {
|
||||
escapement_delta tdelta;
|
||||
tdelta.space = 0;
|
||||
tdelta.nonspace = 0;
|
||||
|
||||
fOwner->fLink->Attach<escapement_delta>(tdelta);
|
||||
}
|
||||
|
||||
fOwner->fLink->AttachString(string, length);
|
||||
|
||||
|
@ -2241,8 +2241,13 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
|
||||
if (link.Read(opList, opCount * sizeof(uint32)) >= B_OK &&
|
||||
link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) {
|
||||
|
||||
for (int32 i = 0; i < ptCount; i++)
|
||||
// this might seem a bit weird, but under R5, the shapes
|
||||
// are always offset by the current pen location
|
||||
BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation();
|
||||
for (int32 i = 0; i < ptCount; i++) {
|
||||
ptList[i] += penLocation;
|
||||
fCurrentLayer->ConvertToScreenForDrawing(&ptList[i]);
|
||||
}
|
||||
|
||||
drawingEngine->DrawShape(shapeFrame, opCount, opList, ptCount, ptList,
|
||||
code == AS_FILL_SHAPE);
|
||||
@ -2296,27 +2301,31 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
|
||||
break;
|
||||
}
|
||||
case AS_DRAW_STRING:
|
||||
case AS_DRAW_STRING_WITH_DELTA:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_DRAW_STRING\n", Title()));
|
||||
char* string;
|
||||
int32 length;
|
||||
BPoint location;
|
||||
escapement_delta delta;
|
||||
escapement_delta _delta;
|
||||
escapement_delta* delta = NULL;
|
||||
|
||||
link.Read<int32>(&length);
|
||||
link.Read<BPoint>(&location);
|
||||
link.Read<escapement_delta>(&delta);
|
||||
if (code == AS_DRAW_STRING_WITH_DELTA) {
|
||||
link.Read<escapement_delta>(&_delta);
|
||||
if (_delta.nonspace != 0.0 || _delta.space != 0.0)
|
||||
delta = &_delta;
|
||||
}
|
||||
link.ReadString(&string);
|
||||
|
||||
|
||||
fCurrentLayer->ConvertToScreenForDrawing(&location);
|
||||
BPoint penLocation = drawingEngine->DrawString(string, length,
|
||||
location, &delta);
|
||||
location, delta);
|
||||
|
||||
fCurrentLayer->ConvertFromScreenForDrawing(&penLocation);
|
||||
fCurrentLayer->CurrentState()->SetPenLocation(penLocation);
|
||||
// pen location has changed, update DrawingEngine
|
||||
// TODO: optimize with flags
|
||||
_UpdateDrawState(fCurrentLayer);
|
||||
|
||||
free(string);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user