Motion - Draw Textspeedup

improvement of draw_textn

Description of Patch

I played a little bit with draw_textn and optimized it.

Now instead of array's, with many calculation inside, i'm using pointers and do all calculation outside the loop.

Optimization Steps:

* Insted of running throu draw_table and search for the ascii, i made a lookup table for 127 ascii's where unknown ascii's point to a "blank". This is done for small and big chars.

* For each ascii i use this pointer to the draw_table.pix array, which is only incremented for each pixel.

* The pointer to the image for every line of a ascii is updated by adding a line offset (line_offset).

* To point to the x,y-location of the next acsii i subtract a offset (next_char_offs).

* This all is done in one step for small and big characters.

small bugfixes included:

* prevent writing over right border

* initialize_chars() was called for each thread

Installation of Patch

Download the patch file. If it is packed as a gz or tar.gz unpack it first. Then copy it to the motion source directory and issue the command (assuming the patch file is called filename_of_patch_file.diff)

patch < filename_of_patch_file.diff

Then re-build Motion and test the patch.

Change History of Patch

  • draw_textn.diff Initial revision

Discussion and Comments

Integrated into the source tree and visible in daily snap 20050819.

-- KennethLavrsen - 19 Aug 2005
Topic revision: r6 - 20 Dec 2005, KennethLavrsen
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.