Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Font and Image rendering slow
Re: Font and Image rendering slow [message #60007 is a reply to message #60006] |
Fri, 07 July 2023 01:54   |
Oblivion
Messages: 1214 Registered: August 2007
|
Senior Contributor |
|
|
But you can use the painter efficiently. What you need to consider is not using it in a hot path such as Paint, if possible (if you need high FPS, I mean). A basic but very effective strategy: draw the image elsewhere, and only paint it to system draw in Paint. Also, an image cache will help here significantly.
I have attached a simple code that uses an image cache to draw 100x100 icons.
The example code draws the icon to a ImagePainter object and can manipulate (rotate) it on-the-fly, without a significant performance hit. Only 8 slots of the cache will be filled in this code (rotation is in 4 directions * left and right, so 8 images total). Images have alpha channel enabled.
The result of consecutive 305 rotations (window maximized, GTK, 1920x1080), calls to Paint (RELEASE MODE), no explicit clip:
TIMING Paint : 834.63 ms - 2.74 ms (835.00 ms / 305 ), min: 2.00 ms, max: 4.00 ms, nesting: 0 - 305
Edit: Code updated.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Fri, 07 July 2023 02:18] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Jul 05 02:55:36 CEST 2025
Total time taken to generate the page: 0.04221 seconds
|