mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45: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
|
* 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
|
* Switching to the Grid view style with a placeholder shown in the gamelist crashed the application
|
||||||
* FileSystemUtil::getDirContent crashed when searching through directories recursively
|
* 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 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)
|
* 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
|
* The scraper didn't handle error conditions correctly
|
||||||
|
|
|
@ -128,10 +128,12 @@ void Font::unloadTextures()
|
||||||
it->deinitTexture();
|
it->deinitTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::FontTexture::FontTexture()
|
Font::FontTexture::FontTexture(const int mSize)
|
||||||
{
|
{
|
||||||
textureId = 0;
|
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();
|
writePos = Vector2i::Zero();
|
||||||
rowHeight = 0;
|
rowHeight = 0;
|
||||||
}
|
}
|
||||||
|
@ -197,9 +199,8 @@ void Font::getTextureForNewGlyph(const Vector2i& glyphSize,
|
||||||
return; // Yes.
|
return; // Yes.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current textures are full,
|
// Current textures are full, make a new one.
|
||||||
// make a new one.
|
mTextures.push_back(FontTexture(mSize));
|
||||||
mTextures.push_back(FontTexture());
|
|
||||||
tex_out = &mTextures.back();
|
tex_out = &mTextures.back();
|
||||||
tex_out->initTexture();
|
tex_out->initTexture();
|
||||||
|
|
||||||
|
@ -607,7 +608,7 @@ TextCache* Font::buildTextCache(
|
||||||
convertedColor };
|
convertedColor };
|
||||||
|
|
||||||
// Round vertices.
|
// Round vertices.
|
||||||
for (int i = 1; i < 5; ++i)
|
for (int i = 1; i < 5; i++)
|
||||||
vertices[i].pos.round();
|
vertices[i].pos.round();
|
||||||
|
|
||||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
Vector2i writePos;
|
Vector2i writePos;
|
||||||
int rowHeight;
|
int rowHeight;
|
||||||
|
|
||||||
FontTexture();
|
FontTexture(const int mSize);
|
||||||
~FontTexture();
|
~FontTexture();
|
||||||
bool findEmpty(const Vector2i& size, Vector2i& cursor_out);
|
bool findEmpty(const Vector2i& size, Vector2i& cursor_out);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue