mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-19 21:52:45 +00:00
Avoid another allocation, this time with atlas fonts
This commit is contained in:
parent
ce980af01e
commit
3def2ddb00
@ -521,7 +521,6 @@ void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, const Bo
|
||||
return;
|
||||
}
|
||||
|
||||
std::string toMeasure = std::string(text);
|
||||
int wrap = align & (FLAG_WRAP_TEXT | FLAG_ELLIPSIZE_TEXT);
|
||||
if (wrap) {
|
||||
const AtlasFont *font = fontAtlas_->getFont(font_id);
|
||||
@ -532,10 +531,12 @@ void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, const Bo
|
||||
*h = 0.0f;
|
||||
return;
|
||||
}
|
||||
std::string toMeasure = std::string(text);
|
||||
AtlasWordWrapper wrapper(*font, fontscalex, toMeasure, bounds.w, wrap);
|
||||
toMeasure = wrapper.Wrapped();
|
||||
} else {
|
||||
MeasureText(font_id, text, w, h);
|
||||
}
|
||||
MeasureText(font_id, toMeasure, w, h);
|
||||
}
|
||||
|
||||
void DrawBuffer::DrawTextShadow(FontID font, std::string_view text, float x, float y, Color color, int flags) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user