mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 15:30:35 +00:00
Merge pull request #14067 from unknownbrackets/ppge-text-alloc
PPGe: Fallback to atlas text on alloc fail
This commit is contained in:
commit
93478e0b97
@ -125,7 +125,7 @@ struct PPGeTextDrawerImage {
|
||||
TextStringEntry entry;
|
||||
u32 ptr;
|
||||
};
|
||||
std::map<PPGeTextDrawerCacheKey, PPGeTextDrawerImage> textDrawerImages;
|
||||
static std::map<PPGeTextDrawerCacheKey, PPGeTextDrawerImage> textDrawerImages;
|
||||
|
||||
void PPGeSetDrawContext(Draw::DrawContext *draw) {
|
||||
g_draw = draw;
|
||||
@ -364,6 +364,10 @@ void __PPGeShutdown()
|
||||
|
||||
delete textDrawer;
|
||||
textDrawer = nullptr;
|
||||
|
||||
for (auto im : textDrawerImages)
|
||||
kernelMemory.Free(im.second.ptr);
|
||||
textDrawerImages.clear();
|
||||
}
|
||||
|
||||
void PPGeBegin()
|
||||
@ -913,8 +917,10 @@ void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style) {
|
||||
|
||||
if (HasTextDrawer()) {
|
||||
PPGeTextDrawerImage im = PPGeGetTextImage(text, style, 480.0f - x, false);
|
||||
PPGeDrawTextImage(im, x, y, style);
|
||||
return;
|
||||
if (im.ptr) {
|
||||
PPGeDrawTextImage(im, x, y, style);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (style.hasShadow) {
|
||||
@ -988,8 +994,10 @@ void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, fl
|
||||
}
|
||||
|
||||
PPGeTextDrawerImage im = PPGeGetTextImage(s.c_str(), adjustedStyle, wrapWidth <= 0 ? 480.0f - x : wrapWidth, true);
|
||||
PPGeDrawTextImage(im, x, y, adjustedStyle);
|
||||
return;
|
||||
if (im.ptr) {
|
||||
PPGeDrawTextImage(im, x, y, adjustedStyle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int sx = style.hasShadow ? 1 : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user