summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-17 17:31:54 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-17 17:31:54 +0200
commit3c4b110ae014972c4c2e7a6c9704cd1b6c79f6ef (patch)
treebfe2a84edd5d2ae0f0de942cd3f51f77efe74dfa
parentfde8838316f3f73e91ddc4e203a9a2a6c0ac327b (diff)
parent21341ddaed0469baa8f24b4c2fae76275cce59e0 (diff)
Merge pull request #67521 from nikitalita/speed_up_texture_pos
Speed up `find_texture_pos_for_glyph()`
-rw-r--r--modules/text_server_adv/text_server_adv.cpp4
-rw-r--r--modules/text_server_fb/text_server_fb.cpp3
2 files changed, 4 insertions, 3 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index e21b517f0a..0929d3a2b0 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -810,12 +810,12 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_
ret.y = 0x7fffffff;
ret.x = 0;
+ const int *ct_offsets_ptr = ct.offsets.ptr();
for (int j = 0; j < ct.texture_w - mw; j++) {
int max_y = 0;
-
for (int k = j; k < j + mw; k++) {
- int y = ct.offsets[k];
+ int y = ct_offsets_ptr[k];
if (y > max_y) {
max_y = y;
}
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index c00d992475..4a46e17868 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -233,12 +233,13 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_
ret.y = 0x7fffffff;
ret.x = 0;
+ const int *ct_offsets_ptr = ct.offsets.ptr();
for (int j = 0; j < ct.texture_w - mw; j++) {
int max_y = 0;
for (int k = j; k < j + mw; k++) {
- int y = ct.offsets[k];
+ int y = ct_offsets_ptr[k];
if (y > max_y) {
max_y = y;
}