@ -321,22 +321,22 @@
# pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
# pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
# pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
# pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
# pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
# pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
# pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion chanjges signedness //
# endif
# endif
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// STB libraries implementation
// STB libraries implementation
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
# define STBRP_STATIC
# define STB_RECT_PACK_IMPLEMENTATION
# ifdef __clang__
# ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-function"
# pragma clang diagnostic ignored "-Wunused-function"
# pragma clang diagnostic ignored "-Wmissing-prototypes"
# endif
# endif
# define STBRP_STATIC
# define STB_RECT_PACK_IMPLEMENTATION
# include "stb_rect_pack.h"
# include "stb_rect_pack.h"
# ifdef __clang__
# pragma clang diagnostic pop
# endif
# define STB_TRUETYPE_IMPLEMENTATION
# define STB_TRUETYPE_IMPLEMENTATION
# define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x))
# define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x))
@ -348,6 +348,10 @@ struct ImGuiTextEditState;
# define STB_TEXTEDIT_CHARTYPE ImWchar
# define STB_TEXTEDIT_CHARTYPE ImWchar
# include "stb_textedit.h"
# include "stb_textedit.h"
# ifdef __clang__
# pragma clang diagnostic pop
# endif
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Forward Declarations
// Forward Declarations
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
@ -6376,11 +6380,11 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid
{
{
unsigned char * pixels ;
unsigned char * pixels ;
GetTexDataAsAlpha8 ( & pixels , NULL , NULL ) ;
GetTexDataAsAlpha8 ( & pixels , NULL , NULL ) ;
TexPixelsRGBA32 = ( unsigned int * ) ImGui : : MemAlloc ( TexWidth * TexHeight * 4 ) ;
TexPixelsRGBA32 = ( unsigned int * ) ImGui : : MemAlloc ( ( size_t ) ( TexWidth * TexHeight * 4 ) ) ;
const unsigned char * src = pixels ;
const unsigned char * src = pixels ;
unsigned int * dst = TexPixelsRGBA32 ;
unsigned int * dst = TexPixelsRGBA32 ;
for ( int n = TexWidth * TexHeight ; n > 0 ; n - - )
for ( int n = TexWidth * TexHeight ; n > 0 ; n - - )
* dst + + = ( ( * src + + ) < < 24 ) | 0x00FFFFFF ;
* dst + + = ( ( unsigned int ) ( * src + + ) < < 24 ) | 0x00FFFFFF ;
}
}
* out_pixels = ( unsigned char * ) TexPixelsRGBA32 ;
* out_pixels = ( unsigned char * ) TexPixelsRGBA32 ;
@ -6440,7 +6444,7 @@ ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* in_ttf_data, size_t in_ttf_data_
data - > TTFDataSize = in_ttf_data_size ;
data - > TTFDataSize = in_ttf_data_size ;
data - > SizePixels = size_pixels ;
data - > SizePixels = size_pixels ;
data - > GlyphRanges = glyph_ranges ;
data - > GlyphRanges = glyph_ranges ;
data - > FontNo = 0 ;
data - > FontNo = font_no ;
InputData . push_back ( data ) ;
InputData . push_back ( data ) ;
// Invalidate texture
// Invalidate texture
@ -6497,7 +6501,7 @@ bool ImFontAtlas::Build()
// Setup ranges
// Setup ranges
int glyph_count = 0 ;
int glyph_count = 0 ;
in t glyph_ranges_count = 0 ;
size_ t glyph_ranges_count = 0 ;
for ( const ImWchar * in_range = data . GlyphRanges ; in_range [ 0 ] & & in_range [ 1 ] ; in_range + = 2 )
for ( const ImWchar * in_range = data . GlyphRanges ; in_range [ 0 ] & & in_range [ 1 ] ; in_range + = 2 )
{
{
glyph_count + = ( in_range [ 1 ] - in_range [ 0 ] ) + 1 ;
glyph_count + = ( in_range [ 1 ] - in_range [ 0 ] ) + 1 ;
@ -6577,10 +6581,10 @@ bool ImFontAtlas::Build()
data . OutFont - > Glyphs . resize ( data . OutFont - > Glyphs . size ( ) + 1 ) ;
data . OutFont - > Glyphs . resize ( data . OutFont - > Glyphs . size ( ) + 1 ) ;
ImFont : : Glyph & glyph = data . OutFont - > Glyphs . back ( ) ;
ImFont : : Glyph & glyph = data . OutFont - > Glyphs . back ( ) ;
glyph . Codepoint = ( ImWchar ) codepoint ;
glyph . Codepoint = ( ImWchar ) codepoint ;
glyph . Width = pc . x1 - pc . x0 + 1 ;
glyph . Width = ( signed short ) pc . x1 - pc . x0 + 1 ;
glyph . Height = pc . y1 - pc . y0 + 1 ;
glyph . Height = ( signed short ) pc . y1 - pc . y0 + 1 ;
glyph . XOffset = ( signed short ) ( pc . xoff ) ;
glyph . XOffset = ( signed short ) ( pc . xoff ) ;
glyph . YOffset = ( signed short ) ( pc . yoff ) + ( int ) ( font_ascent * font_scale ) ;
glyph . YOffset = ( signed short ) ( pc . yoff + ( int ) ( font_ascent * font_scale ) ) ;
glyph . XAdvance = ( signed short ) ( pc . xadvance + character_spacing_x ) ; // Bake spacing into XAdvance
glyph . XAdvance = ( signed short ) ( pc . xadvance + character_spacing_x ) ; // Bake spacing into XAdvance
glyph . U0 = ( ( float ) pc . x0 - 0.5f ) * uv_scale_x ;
glyph . U0 = ( ( float ) pc . x0 - 0.5f ) * uv_scale_x ;
glyph . V0 = ( ( float ) pc . y0 - 0.5f ) * uv_scale_y ;
glyph . V0 = ( ( float ) pc . y0 - 0.5f ) * uv_scale_y ;