diff --git a/src/apps/remotedesktop/RemoteView.cpp b/src/apps/remotedesktop/RemoteView.cpp index 62f6aa30da..485c4752cf 100644 --- a/src/apps/remotedesktop/RemoteView.cpp +++ b/src/apps/remotedesktop/RemoteView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2009, Haiku, Inc. + * Copyright 2009-2010, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -1228,6 +1229,46 @@ RemoteView::_DrawThread() 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: { BRect bounds;