mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Fixed an issue where large text sizes at high resolutions would crash the application.
This commit is contained in:
parent
917ed738a0
commit
09e5095a08
|
@ -95,6 +95,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
|
|||
* If the user tried to enter a blank game name in the metadata editor, the application would crash upon saving
|
||||
* Switching to the Grid view style with a placeholder shown in the gamelist crashed the application
|
||||
* FileSystemUtil::getDirContent crashed when searching through directories recursively
|
||||
* Large text sizes at higher resolutions (such as 4K) would crash the application as fixed-size texture buffers were used which weren't big enough to hold the larger font textures
|
||||
* Fixed a massive memory leak related to SVG images
|
||||
* Fixed an issue where SVG images would sometimes be cut off slightly on the right side (e.g. logos on the system view carousel)
|
||||
* The scraper didn't handle error conditions correctly
|
||||
|
|
|
@ -128,10 +128,12 @@ void Font::unloadTextures()
|
|||
it->deinitTexture();
|
||||
}
|
||||
|
||||
Font::FontTexture::FontTexture()
|
||||
Font::FontTexture::FontTexture(const int mSize)
|
||||
{
|
||||
textureId = 0;
|
||||
textureSize = Vector2i(2048, 512);
|
||||
// I'm not entirely sure if the 16 and 4 constants are correct, but they seem to provide
|
||||
// a texture buffer large enough to hold the fonts. (Otherwise the application would crash.)
|
||||
textureSize = Vector2i(mSize * 16, mSize * 4);
|
||||
writePos = Vector2i::Zero();
|
||||
rowHeight = 0;
|
||||
}
|
||||
|
@ -197,9 +199,8 @@ void Font::getTextureForNewGlyph(const Vector2i& glyphSize,
|
|||
return; // Yes.
|
||||
}
|
||||
|
||||
// Current textures are full,
|
||||
// make a new one.
|
||||
mTextures.push_back(FontTexture());
|
||||
// Current textures are full, make a new one.
|
||||
mTextures.push_back(FontTexture(mSize));
|
||||
tex_out = &mTextures.back();
|
||||
tex_out->initTexture();
|
||||
|
||||
|
@ -607,7 +608,7 @@ TextCache* Font::buildTextCache(
|
|||
convertedColor };
|
||||
|
||||
// Round vertices.
|
||||
for (int i = 1; i < 5; ++i)
|
||||
for (int i = 1; i < 5; i++)
|
||||
vertices[i].pos.round();
|
||||
|
||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||
|
|
|
@ -106,7 +106,7 @@ private:
|
|||
Vector2i writePos;
|
||||
int rowHeight;
|
||||
|
||||
FontTexture();
|
||||
FontTexture(const int mSize);
|
||||
~FontTexture();
|
||||
bool findEmpty(const Vector2i& size, Vector2i& cursor_out);
|
||||
|
||||
|
|
Loading…
Reference in a new issue