extended support for BPicture, still not working

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16006 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-01-18 21:29:29 +00:00
parent af675e2c03
commit 92071609a1
2 changed files with 46 additions and 17 deletions

View File

@ -8,6 +8,8 @@
#include <ServerProtocol.h>
#include <TPicture.h>
#include <Bitmap.h>
#include <stdio.h>
@ -162,13 +164,15 @@ fill_shape(ViewLayer *view, BShape *shape)
static void
draw_string(ViewLayer *view, char *string, float deltax, float deltay)
draw_string(ViewLayer *view, char *string, float deltaSpace, float deltaNonSpace)
{
//int32 len = string ? strlen(string) : 0;
//view->DrawString(string, len, NULL);
printf("DrawString(\"%s\", %.2f, %.2f)\n", string, deltax, deltay);
BPoint location = view->CurrentState()->PenLocation();
escapement_delta delta = {deltaSpace, deltaNonSpace };
view->ConvertToScreenForDrawing(&location);
view->Window()->GetDrawingEngine()->DrawString(string, strlen(string), location,
view->CurrentState(), &delta);
// TODO: Update pen location ?
}
@ -176,19 +180,18 @@ static void
draw_pixels(ViewLayer *view, BRect src, BRect dest, int32 width, int32 height,
int32 bytesPerRow, int32 pixelFormat, int32 flags, void *data)
{
//ServerBitmap bitmap(BRect(0, 0, width - 1, height - 1),
// (color_space)pixelFormat);
/*BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, width - 1, height - 1),
flags | B_BITMAP_NO_SERVER_LINK, (color_space)pixelFormat);
if (bitmap == NULL || bitmap->ImportBits(data, bytesPerRow * height,
bitmap->BytesPerRow(), 0, (color_space)pixelFormat) < B_OK)
return;
//bitmap.SetBits(data, bytesPerRow * height, 0, (color_space)pixelFormat);
view->ConvertToScreenForDrawing(&dest);
view->Window()->GetDrawingEngine()->DrawBitmap(bitmap, src, dest, view->CurrentState());
//view->DrawBitmap(&bitmap, src, dest);
printf("DrawPixels(BRect(%.2f, %.2f, %.2f, %.2f),\n"
"BRect(%.2f, %.2f, %.2f, %.2f),\n"
"%ld, %ld, %ld, %ld, %ld)\n",
src.left, src.top, src.right, src.bottom,
dest.left, dest.top, dest.right, dest.bottom,
width, height, bytesPerRow, pixelFormat, flags);
delete bitmap;*/
}

View File

@ -2257,7 +2257,33 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
picture->EndOp();
break;
}
case AS_DRAW_STRING:
{
char* string;
int32 length;
BPoint location;
escapement_delta delta;
link.Read<int32>(&length);
link.Read<BPoint>(&location);
link.Read<escapement_delta>(&delta);
link.ReadString(&string);
picture->BeginOp(B_PIC_MOVE_PEN_BY);
picture->AddCoord(location - fCurrentLayer->CurrentState()->PenLocation());
picture->EndOp();
picture->BeginOp(B_PIC_DRAW_STRING);
picture->AddInt32(length);
picture->AddData(string, length);
picture->AddFloat(delta.space);
picture->AddFloat(delta.nonspace);
picture->EndOp();
break;
}
case AS_LAYER_DRAW_BITMAP:
{
int32 token;