summaryrefslogtreecommitdiff
path: root/src/textmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-16 02:35:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-16 02:35:53 +0300
commit5322c7672c4192fb20f3f2f1f0c45183efe4bf9f (patch)
treea9a070cbb60c7c33c124564b6da77a0d10fb45bf /src/textmanager.cpp
parenta674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc (diff)
downloadplus-5322c7672c4192fb20f3f2f1f0c45183efe4bf9f.tar.gz
plus-5322c7672c4192fb20f3f2f1f0c45183efe4bf9f.tar.bz2
plus-5322c7672c4192fb20f3f2f1f0c45183efe4bf9f.tar.xz
plus-5322c7672c4192fb20f3f2f1f0c45183efe4bf9f.zip
improve a bit names draw speed.
Diffstat (limited to 'src/textmanager.cpp')
-rw-r--r--src/textmanager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 9a27c9397..29081769d 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -77,7 +77,7 @@ void TextManager::place(const Text *const textObj, const Text *const omit,
const int xLeft = textObj->mX;
const int xRight1 = xLeft + textObj->mWidth;
const int TEST = 50; // Number of lines to test for text
- const int nBeings = 50;
+ const int nBeings = 30;
bool occupied[TEST]; // is some other text obscuring this line?
std::memset(&occupied, 0, sizeof(occupied)); // set all to false
const int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text
@@ -105,8 +105,15 @@ void TextManager::place(const Text *const textObj, const Text *const omit,
}
}
bool ok = true;
- for (int i = wantedTop; i < wantedTop + h; ++ i)
- ok = ok && !occupied[i];
+ const int sz = wantedTop + h;
+ for (int i = wantedTop; i < sz; i ++)
+ {
+ if (occupied[i])
+ {
+ ok = false;
+ break;
+ }
+ }
if (ok)
return;
@@ -114,7 +121,8 @@ void TextManager::place(const Text *const textObj, const Text *const omit,
// Have to move it up or down, so find nearest spaces either side
int consec = 0;
int upSlot = -1; // means not found
- for (int seek = wantedTop + h - 2; seek >= 0; --seek)
+ const int sz2 = wantedTop + h - 2;
+ for (int seek = sz2; seek >= 0; --seek)
{
if (occupied[seek])
{