mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-23 10:19:55 +00:00
ImFontAtlas: Fixed calling Clear() and rebuilding (broken in 3fe2ecfd4c
) thanks @pdoane @mikesart
This commit is contained in:
parent
bbd6d5d5b5
commit
09f6f564d9
1
imgui.h
1
imgui.h
@ -1432,7 +1432,6 @@ struct ImFontAtlas
|
|||||||
|
|
||||||
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
||||||
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font.
|
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font.
|
||||||
IMGUI_API void ClearCustomRects();
|
|
||||||
IMGUI_API void CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max);
|
IMGUI_API void CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max);
|
||||||
const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
||||||
|
|
||||||
|
@ -1134,6 +1134,8 @@ void ImFontAtlas::ClearInputData()
|
|||||||
}
|
}
|
||||||
ConfigData.clear();
|
ConfigData.clear();
|
||||||
CustomRects.clear();
|
CustomRects.clear();
|
||||||
|
for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)
|
||||||
|
CustomRectIds[n] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlas::ClearTexData()
|
void ImFontAtlas::ClearTexData()
|
||||||
@ -1597,6 +1599,8 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* pack_context_opaq
|
|||||||
stbrp_context* pack_context = (stbrp_context*)pack_context_opaque;
|
stbrp_context* pack_context = (stbrp_context*)pack_context_opaque;
|
||||||
|
|
||||||
ImVector<ImFontAtlas::CustomRect>& user_rects = atlas->CustomRects;
|
ImVector<ImFontAtlas::CustomRect>& user_rects = atlas->CustomRects;
|
||||||
|
IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.
|
||||||
|
|
||||||
ImVector<stbrp_rect> pack_rects;
|
ImVector<stbrp_rect> pack_rects;
|
||||||
pack_rects.resize(user_rects.Size);
|
pack_rects.resize(user_rects.Size);
|
||||||
memset(pack_rects.Data, 0, sizeof(stbrp_rect) * user_rects.Size);
|
memset(pack_rects.Data, 0, sizeof(stbrp_rect) * user_rects.Size);
|
||||||
|
Loading…
Reference in New Issue
Block a user