Improved the DrawString() method that takes offsets per glyph by making the

client provide the array size. Added version that doesn't take a string length
for convenience.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35866 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-03-15 15:08:07 +00:00
parent 77e5acc0d9
commit a9daf3d911
3 changed files with 21 additions and 7 deletions
+15 -5
View File
@@ -45,7 +45,6 @@
#include <String.h>
#include <Window.h>
#include <utf8_functions.h>
#include <AppMisc.h>
#include <AppServerLink.h>
#include <binary_compatibility/Interface.h>
@@ -2571,7 +2570,19 @@ BView::DrawString(const char* string, int32 length, BPoint location,
void
BView::DrawString(const char* string, int32 length, const BPoint* locations)
BView::DrawString(const char* string, const BPoint* locations,
int32 locationCount)
{
if (string == NULL)
return;
DrawString(string, strlen(string), locations, locationCount);
}
void
BView::DrawString(const char* string, int32 length, const BPoint* locations,
int32 locationCount)
{
if (fOwner == NULL || string == NULL || length < 1 || locations == NULL)
return;
@@ -2580,11 +2591,10 @@ BView::DrawString(const char* string, int32 length, const BPoint* locations)
fOwner->fLink->StartMessage(AS_DRAW_STRING_WITH_OFFSETS);
int32 glyphCount = UTF8CountChars(string, length);
fOwner->fLink->Attach<int32>(length);
fOwner->fLink->Attach<int32>(glyphCount);
fOwner->fLink->Attach<int32>(locationCount);
fOwner->fLink->Attach(string, length);
fOwner->fLink->Attach(locations, glyphCount * sizeof(BPoint));
fOwner->fLink->Attach(locations, locationCount * sizeof(BPoint));
_FlushIfNotInTransaction();