mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: Fixed various small warnings / build issues.
This commit is contained in:
parent
dec8d3863a
commit
93410c47e1
3 changed files with 10 additions and 5 deletions
|
|
@ -16670,7 +16670,7 @@ void ImGui::DebugNodeFontGlyph(ImFont* font, const ImFontGlyph* glyph)
|
||||||
if (glyph->PackId >= 0)
|
if (glyph->PackId >= 0)
|
||||||
{
|
{
|
||||||
ImFontAtlasRect* r = ImFontAtlasPackGetRect(font->ContainerAtlas, glyph->PackId);
|
ImFontAtlasRect* r = ImFontAtlasPackGetRect(font->ContainerAtlas, glyph->PackId);
|
||||||
Text("PackId: %d (%dx%d rect at %d,%d)", glyph->PackId, r->w, r->h, r->x, r->y);;
|
Text("PackId: %d (%dx%d rect at %d,%d)", glyph->PackId, r->w, r->h, r->x, r->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
imgui.h
4
imgui.h
|
|
@ -339,7 +339,7 @@ struct ImTextureRef
|
||||||
{
|
{
|
||||||
ImTextureRef() { memset(this, 0, sizeof(*this)); }
|
ImTextureRef() { memset(this, 0, sizeof(*this)); }
|
||||||
ImTextureRef(ImTextureID tex_id) { memset(this, 0, sizeof(*this)); _TexID = tex_id; }
|
ImTextureRef(ImTextureID tex_id) { memset(this, 0, sizeof(*this)); _TexID = tex_id; }
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && !defined(ImTextureUserID)
|
||||||
ImTextureRef(void* tex_id) { memset(this, 0, sizeof(*this)); _TexID = (ImTextureID)(size_t)tex_id; } // For legacy backends casting to ImTextureID
|
ImTextureRef(void* tex_id) { memset(this, 0, sizeof(*this)); _TexID = (ImTextureID)(size_t)tex_id; } // For legacy backends casting to ImTextureID
|
||||||
//inline operator intptr_t() const { return (intptr_t)_TexID; } // For legacy backends casting to ImTextureID
|
//inline operator intptr_t() const { return (intptr_t)_TexID; } // For legacy backends casting to ImTextureID
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3406,7 +3406,7 @@ struct IMGUI_API ImTextureData
|
||||||
unsigned char* GetPixelsAt(int x, int y) { IM_ASSERT(Pixels != NULL); return Pixels + (x + y * Width) * BytesPerPixel; }
|
unsigned char* GetPixelsAt(int x, int y) { IM_ASSERT(Pixels != NULL); return Pixels + (x + y * Width) * BytesPerPixel; }
|
||||||
int GetSizeInBytes() const { return Width * Height * BytesPerPixel; }
|
int GetSizeInBytes() const { return Width * Height * BytesPerPixel; }
|
||||||
int GetPitch() const { return Width * BytesPerPixel; }
|
int GetPitch() const { return Width * BytesPerPixel; }
|
||||||
ImTextureRef GetTexRef() const { ImTextureRef tex_ref; tex_ref._TexData = (ImTextureData*)(void*)this; tex_ref._TexID = TexID; return tex_ref; }
|
ImTextureRef GetTexRef() { ImTextureRef tex_ref; tex_ref._TexData = this; tex_ref._TexID = TexID; return tex_ref; }
|
||||||
ImTextureID GetTexID() const { return TexID; }
|
ImTextureID GetTexID() const { return TexID; }
|
||||||
|
|
||||||
// Called by Renderer backend
|
// Called by Renderer backend
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ Index of this file:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||||
|
#include <stdint.h> // intptr_t
|
||||||
|
|
||||||
// Visual Studio warnings
|
// Visual Studio warnings
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
@ -3193,6 +3194,7 @@ void ImFontAtlas::RemoveFont(ImFont* font)
|
||||||
|
|
||||||
bool removed = Fonts.find_erase(font);
|
bool removed = Fonts.find_erase(font);
|
||||||
IM_ASSERT(removed);
|
IM_ASSERT(removed);
|
||||||
|
IM_UNUSED(removed);
|
||||||
|
|
||||||
Sources.erase(font->Sources, font->Sources + font->SourcesCount);
|
Sources.erase(font->Sources, font->Sources + font->SourcesCount);
|
||||||
ImFontAtlasBuildUpdatePointers(this);
|
ImFontAtlasBuildUpdatePointers(this);
|
||||||
|
|
@ -3644,6 +3646,7 @@ void ImFontAtlasBuildSetupFontSpecialGlyphs(ImFontAtlas* atlas, ImFont* font, Im
|
||||||
const int src_idx_in_font = (int)(src - font->Sources);
|
const int src_idx_in_font = (int)(src - font->Sources);
|
||||||
IM_ASSERT(src_idx_in_font >= 0 && src_idx_in_font < font->SourcesCount);
|
IM_ASSERT(src_idx_in_font >= 0 && src_idx_in_font < font->SourcesCount);
|
||||||
IM_UNUSED(atlas);
|
IM_UNUSED(atlas);
|
||||||
|
IM_UNUSED(src_idx_in_font);
|
||||||
|
|
||||||
// Find Fallback character. Actual glyph loaded in GetFontBaked().
|
// Find Fallback character. Actual glyph loaded in GetFontBaked().
|
||||||
const ImWchar fallback_chars[] = { font->FallbackChar, (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' };
|
const ImWchar fallback_chars[] = { font->FallbackChar, (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' };
|
||||||
|
|
@ -3680,9 +3683,10 @@ void ImFontAtlasBuildDiscardFontBakedGlyph(ImFontAtlas* atlas, ImFont* font, ImF
|
||||||
ImFontAtlasPackDiscardRect(atlas, glyph->PackId);
|
ImFontAtlasPackDiscardRect(atlas, glyph->PackId);
|
||||||
glyph->PackId = -1;
|
glyph->PackId = -1;
|
||||||
}
|
}
|
||||||
ImWchar c = glyph->Codepoint;
|
ImWchar c = (ImWchar)glyph->Codepoint;
|
||||||
IM_ASSERT(font->FallbackChar != c && font->EllipsisChar != c); // Unsupported for simplicity
|
IM_ASSERT(font->FallbackChar != c && font->EllipsisChar != c); // Unsupported for simplicity
|
||||||
IM_ASSERT(glyph >= baked->Glyphs.Data && glyph < baked->Glyphs.Data + baked->Glyphs.Size);
|
IM_ASSERT(glyph >= baked->Glyphs.Data && glyph < baked->Glyphs.Data + baked->Glyphs.Size);
|
||||||
|
IM_UNUSED(font);
|
||||||
baked->IndexLookup[c] = IM_FONTGLYPH_INDEX_UNUSED;
|
baked->IndexLookup[c] = IM_FONTGLYPH_INDEX_UNUSED;
|
||||||
baked->IndexAdvanceX[c] = baked->FallbackAdvanceX;
|
baked->IndexAdvanceX[c] = baked->FallbackAdvanceX;
|
||||||
}
|
}
|
||||||
|
|
@ -4371,6 +4375,7 @@ void ImFontAtlasDebugLogTextureRequests(ImFontAtlas* atlas)
|
||||||
IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update %d regions, texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, tex->Updates.Size, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData);
|
IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update %d regions, texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, tex->Updates.Size, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData);
|
||||||
for (const ImTextureRect& r : tex->Updates)
|
for (const ImTextureRect& r : tex->Updates)
|
||||||
{
|
{
|
||||||
|
IM_UNUSED(r);
|
||||||
IM_ASSERT(r.x >= 0 && r.y >= 0);
|
IM_ASSERT(r.x >= 0 && r.y >= 0);
|
||||||
IM_ASSERT(r.x + r.w <= tex->Width && r.y + r.h <= tex->Height); // In theory should subtract PackPadding but it's currently part of atlas and mid-frame change would wreck assert.
|
IM_ASSERT(r.x + r.w <= tex->Width && r.y + r.h <= tex->Height); // In theory should subtract PackPadding but it's currently part of atlas and mid-frame change would wreck assert.
|
||||||
//IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update (% 4d..%-4d)->(% 4d..%-4d), texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, r.x, r.y, r.x + r.w, r.y + r.h, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData);
|
//IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update (% 4d..%-4d)->(% 4d..%-4d), texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, r.x, r.y, r.x + r.w, r.y + r.h, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData);
|
||||||
|
|
@ -5141,7 +5146,7 @@ ImFontBaked* ImFont::GetFontBaked(float size)
|
||||||
{
|
{
|
||||||
baked->LastUsedFrame = builder->FrameCount;
|
baked->LastUsedFrame = builder->FrameCount;
|
||||||
LastBaked = baked;
|
LastBaked = baked;
|
||||||
return baked;;
|
return baked;
|
||||||
}
|
}
|
||||||
if (atlas->Locked)
|
if (atlas->Locked)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue