From 26a2be8ba57f87fc8a5c6e5845defa5816f77329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 2 Nov 2005 13:14:03 +0000 Subject: [PATCH] less overhead when byte count of string is already known git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14639 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/servers/app/ServerFont.h | 1 + src/servers/app/ServerApp.cpp | 2 +- src/servers/app/ServerFont.cpp | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/headers/private/servers/app/ServerFont.h b/headers/private/servers/app/ServerFont.h index 8c4bc063c0..728b208de2 100644 --- a/headers/private/servers/app/ServerFont.h +++ b/headers/private/servers/app/ServerFont.h @@ -127,6 +127,7 @@ class ServerFont { BPoint offsetArray[]) const; bool GetEscapements(const char charArray[], int32 numChars, + int32 numBytes, float widthArray[], escapement_delta delta) const; diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 8af0b31433..12d4d1874b 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -1852,7 +1852,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) font.SetRotation(rotation); font.SetFlags(flags); - if (font.GetEscapements(charArray, numChars, escapements, delta)) { + if (font.GetEscapements(charArray, numChars, numBytes, escapements, delta)) { fLink.StartMessage(B_OK); fLink.Attach(escapements, numChars * sizeof(float)); } else diff --git a/src/servers/app/ServerFont.cpp b/src/servers/app/ServerFont.cpp index 854a1a6d93..fa59a8c854 100644 --- a/src/servers/app/ServerFont.cpp +++ b/src/servers/app/ServerFont.cpp @@ -509,7 +509,7 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars, // GetEscapements bool -ServerFont::GetEscapements(const char charArray[], int32 numChars, +ServerFont::GetEscapements(const char charArray[], int32 numChars, int32 numBytes, float widthArray[], escapement_delta delta) const { if (!fStyle || !charArray || numChars <= 0) @@ -525,7 +525,6 @@ ServerFont::GetEscapements(const char charArray[], int32 numChars, // UTF8 handling...this can probably be smarter // Here is what I do in the AGGTextRenderer to handle UTF8... // It is probably highly inefficient, so it should be reviewed. - int32 numBytes = UTF8CountBytes(charArray, numChars); int32 convertedLength = numBytes * 2; char* convertedBuffer = new char[convertedLength]; @@ -631,7 +630,7 @@ ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[], FT_Set_Char_Size(face, 0, int32(fSize * 64), 72, 72); for (int32 i=0; i