Implement RP_DRAW_STRING_WITH_OFFSETS. Untested though, especially the bounding
box part should be validated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40016 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Haiku, Inc.
|
* Copyright 2009-2010, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
#include <Shape.h>
|
#include <Shape.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
#include <utf8_functions.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -1228,6 +1229,46 @@ RemoteView::_DrawThread()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case RP_DRAW_STRING_WITH_OFFSETS:
|
||||||
|
{
|
||||||
|
size_t length;
|
||||||
|
char *string;
|
||||||
|
message.ReadString(&string, length);
|
||||||
|
int32 count = UTF8CountChars(string, length);
|
||||||
|
|
||||||
|
BPoint offsets[count];
|
||||||
|
if (message.ReadList(offsets, count) != B_OK) {
|
||||||
|
free(string);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
offscreen->DrawString(string, offsets, count);
|
||||||
|
|
||||||
|
free(string);
|
||||||
|
reply.Start(RP_DRAW_STRING_RESULT);
|
||||||
|
reply.Add(token);
|
||||||
|
reply.Add(offscreen->PenLocation());
|
||||||
|
reply.Flush();
|
||||||
|
|
||||||
|
BFont font;
|
||||||
|
offscreen->GetFont(&font);
|
||||||
|
|
||||||
|
BRect boxes[count];
|
||||||
|
font.GetBoundingBoxesAsGlyphs(string, count, B_SCREEN_METRIC,
|
||||||
|
boxes);
|
||||||
|
|
||||||
|
font_height height;
|
||||||
|
offscreen->GetFontHeight(&height);
|
||||||
|
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
// TODO: validate
|
||||||
|
boxes[i].OffsetBy(offsets[i] + BPoint(0, -height.ascent));
|
||||||
|
invalidRegion.Include(boxes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RP_READ_BITMAP:
|
case RP_READ_BITMAP:
|
||||||
{
|
{
|
||||||
BRect bounds;
|
BRect bounds;
|
||||||
|
|||||||
Reference in New Issue
Block a user