|
-
November 17th, 2010, 01:01 PM
#4
Re: GetTextExtentPoint32 is really slow on Windows Mobile, any alternative?
There's no reason for this function to be as slow as you're indicating. It does hide a LOT of processing, so it does take "some" time of course.
But it's not "slow".
Something like DrawText() with multiline/word wrap does lots of calls to this (or similar) functions. Drawing a listcontrol equally does a lot of calls to this function to shorten text by using ellipsis if you have small columns.
Even a slow mobile device should be able to handle a couple hundred calls per second, a modern desktop should be able to handle a couple tens to hundred thousand calls per second.
 Originally Posted by olivthill2
I have used GetTextExtentPoint32() on a desktop PC, and it is slow.
So, now, I use an alternative solution, which is to load the table of widths of the characters and compute the size of my string by adding the widths of characters.
This MAY work, but it won't always work.
- Some fonts/devices use kerning. This will mess up your assumption.
- There may be extra intercharacter spacing (SetTextCharacterExtra) active.
- Justification may be active
- Your calculations may be off for bold and/or italic fonts.
 Originally Posted by itsmeandnobodyelse
The GetTextExtentPoint32 is a messaging method, i. e. it puts an request to the message queue where it was handled delayed depending on the message traffic. Like all GUI transactions it is relatively slow cause a user hardly won't recocnize waiting times less than a second.
UH ? Say what ?
This is just a normal function like so many other, it doesn't do any messages at all.
There's a lot of reasons why a first time would be slower...
- Needing to load/prepare the font for usage,
- Possibly needing to load extra dll's to do text painting
And there's more than enough reasons why it would be "occasionally" slower, such as requi
Although i can't really think of a good reason why that would impact both of the first 2 and not the subsequent ones
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|