mirror of https://github.com/odrling/Aegisub
Make OpenGLTextTexture use the smallest texture that is large enough to fit the requested glyph rather than always using 256x256
Originally committed to SVN as r4250.
This commit is contained in:
parent
27a159793a
commit
c3a986414c
|
@ -267,7 +267,7 @@ OpenGLTextGlyph OpenGLText::CreateGlyph(int n) {
|
||||||
|
|
||||||
// No texture could fit it, create a new one
|
// No texture could fit it, create a new one
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
textures.push_back(new OpenGLTextTexture(256,256));
|
textures.push_back(new OpenGLTextTexture(glyph.w,glyph.h));
|
||||||
textures.back()->TryToInsert(glyph);
|
textures.back()->TryToInsert(glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,8 +285,9 @@ OpenGLTextGlyph OpenGLText::CreateGlyph(int n) {
|
||||||
OpenGLTextTexture::OpenGLTextTexture(int w,int h) {
|
OpenGLTextTexture::OpenGLTextTexture(int w,int h) {
|
||||||
// Properties
|
// Properties
|
||||||
x = y = nextY = 0;
|
x = y = nextY = 0;
|
||||||
width = SmallestPowerOf2(w);
|
width = max(SmallestPowerOf2(w), 64);
|
||||||
height = SmallestPowerOf2(h);
|
height = max(SmallestPowerOf2(h), 64);
|
||||||
|
width = height = max(width, height);
|
||||||
tex = 0;
|
tex = 0;
|
||||||
|
|
||||||
// Generate and bind
|
// Generate and bind
|
||||||
|
|
Loading…
Reference in New Issue