mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use emplace with ICURun and UniscribeRun. (#12693)
parent
856ec901ca
commit
3f5a354f37
|
@ -284,7 +284,7 @@ std::vector<ICURun> ItemizeBidi(UChar *buff, size_t length)
|
||||||
UBiDiLevel level;
|
UBiDiLevel level;
|
||||||
ubidi_getLogicalRun(ubidi, start_pos, &logical_pos, &level);
|
ubidi_getLogicalRun(ubidi, start_pos, &logical_pos, &level);
|
||||||
|
|
||||||
runs.emplace_back(ICURun(start_pos, logical_pos - start_pos, level));
|
runs.emplace_back(start_pos, logical_pos - start_pos, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(static_cast<size_t>(count) == runs.size());
|
assert(static_cast<size_t>(count) == runs.size());
|
||||||
|
@ -315,7 +315,7 @@ std::vector<ICURun> ItemizeScript(UChar *buff, size_t length, std::vector<ICURun
|
||||||
int stop_pos = std::min(script_itemizer.getScriptEnd(), cur_run->start + cur_run->length);
|
int stop_pos = std::min(script_itemizer.getScriptEnd(), cur_run->start + cur_run->length);
|
||||||
assert(stop_pos - cur_pos > 0);
|
assert(stop_pos - cur_pos > 0);
|
||||||
|
|
||||||
runs.push_back(ICURun(cur_pos, stop_pos - cur_pos, cur_run->level, script_itemizer.getScriptCode()));
|
runs.emplace_back(cur_pos, stop_pos - cur_pos, cur_run->level, script_itemizer.getScriptCode());
|
||||||
|
|
||||||
if (stop_pos == cur_run->start + cur_run->length) cur_run++;
|
if (stop_pos == cur_run->start + cur_run->length) cur_run++;
|
||||||
cur_pos = stop_pos;
|
cur_pos = stop_pos;
|
||||||
|
@ -347,7 +347,7 @@ std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &fon
|
||||||
int stop_pos = std::min(font_map.first, cur_run->start + cur_run->length);
|
int stop_pos = std::min(font_map.first, cur_run->start + cur_run->length);
|
||||||
assert(stop_pos - cur_pos > 0);
|
assert(stop_pos - cur_pos > 0);
|
||||||
|
|
||||||
runs.push_back(ICURun(cur_pos, stop_pos - cur_pos, cur_run->level, cur_run->script, font_map.second));
|
runs.emplace_back(cur_pos, stop_pos - cur_pos, cur_run->level, cur_run->script, font_map.second);
|
||||||
|
|
||||||
if (stop_pos == cur_run->start + cur_run->length) cur_run++;
|
if (stop_pos == cur_run->start + cur_run->length) cur_run++;
|
||||||
cur_pos = stop_pos;
|
cur_pos = stop_pos;
|
||||||
|
|
|
@ -302,7 +302,7 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||||
/* Add a range that spans the intersection of the remaining item and font run. */
|
/* Add a range that spans the intersection of the remaining item and font run. */
|
||||||
int stop_pos = std::min(i.first, (cur_item + 1)->iCharPos);
|
int stop_pos = std::min(i.first, (cur_item + 1)->iCharPos);
|
||||||
assert(stop_pos - cur_pos > 0);
|
assert(stop_pos - cur_pos > 0);
|
||||||
ranges.push_back(UniscribeRun(cur_pos, stop_pos - cur_pos, i.second, cur_item->a));
|
ranges.emplace_back(cur_pos, stop_pos - cur_pos, i.second, cur_item->a);
|
||||||
|
|
||||||
/* Shape the range. */
|
/* Shape the range. */
|
||||||
if (!UniscribeShapeRun(buff, ranges.back())) {
|
if (!UniscribeShapeRun(buff, ranges.back())) {
|
||||||
|
|
Loading…
Reference in New Issue