patch ImGui so it supports square textures
in the font atlas
This commit is contained in:
parent
c9b2172c4f
commit
72cd745824
11 changed files with 80 additions and 7 deletions
9
extern/imgui_patched/imgui_draw.cpp
vendored
9
extern/imgui_patched/imgui_draw.cpp
vendored
|
|
@ -2678,6 +2678,15 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||
// 7. Allocate texture
|
||||
atlas->TexHeight = (atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) ? (atlas->TexHeight + 1) : ImUpperPowerOfTwo(atlas->TexHeight);
|
||||
atlas->TexUvScale = ImVec2(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight);
|
||||
|
||||
if (atlas->Flags & ImFontAtlasFlags_Square) {
|
||||
if (atlas->TexWidth>atlas->TexHeight) {
|
||||
atlas->TexHeight=atlas->TexWidth;
|
||||
} else {
|
||||
atlas->TexWidth=atlas->TexHeight;
|
||||
}
|
||||
}
|
||||
|
||||
atlas->TexPixelsAlpha8 = (unsigned char*)IM_ALLOC(atlas->TexWidth * atlas->TexHeight);
|
||||
memset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight);
|
||||
spc.pixels = atlas->TexPixelsAlpha8;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue