mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
Declaration and assignment can be joined, Member function may be 'const'. (#2875)
This commit is contained in:
parent
c863c1f6a1
commit
6bf5aed325
8
imgui.h
8
imgui.h
@ -1630,11 +1630,11 @@ struct ImGuiTextBuffer
|
|||||||
IMGUI_API static char EmptyString[1];
|
IMGUI_API static char EmptyString[1];
|
||||||
|
|
||||||
ImGuiTextBuffer() { }
|
ImGuiTextBuffer() { }
|
||||||
inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
inline char operator[](int i) const { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
||||||
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
||||||
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
||||||
int size() const { return Buf.Size ? Buf.Size - 1 : 0; }
|
int size() const { return Buf.Size ? Buf.Size - 1 : 0; }
|
||||||
bool empty() { return Buf.Size <= 1; }
|
bool empty() const { return Buf.Size <= 1; }
|
||||||
void clear() { Buf.clear(); }
|
void clear() { Buf.clear(); }
|
||||||
void reserve(int capacity) { Buf.reserve(capacity); }
|
void reserve(int capacity) { Buf.reserve(capacity); }
|
||||||
const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; }
|
const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; }
|
||||||
@ -2111,7 +2111,7 @@ struct ImFontAtlas
|
|||||||
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
||||||
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
||||||
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
||||||
bool IsBuilt() { return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); }
|
bool IsBuilt() const { return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); }
|
||||||
void SetTexID(ImTextureID id) { TexID = id; }
|
void SetTexID(ImTextureID id) { TexID = id; }
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
@ -2144,7 +2144,7 @@ struct ImFontAtlas
|
|||||||
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
IMGUI_API void CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max);
|
IMGUI_API void CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max) const;
|
||||||
IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]);
|
IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]);
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
@ -1752,7 +1752,7 @@ int ImFontAtlas::AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int
|
|||||||
return CustomRects.Size - 1; // Return index
|
return CustomRects.Size - 1; // Return index
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlas::CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max)
|
void ImFontAtlas::CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max) const
|
||||||
{
|
{
|
||||||
IM_ASSERT(TexWidth > 0 && TexHeight > 0); // Font atlas needs to be built before we can calculate UV coordinates
|
IM_ASSERT(TexWidth > 0 && TexHeight > 0); // Font atlas needs to be built before we can calculate UV coordinates
|
||||||
IM_ASSERT(rect->IsPacked()); // Make sure the rectangle has been packed
|
IM_ASSERT(rect->IsPacked()); // Make sure the rectangle has been packed
|
||||||
@ -3201,9 +3201,9 @@ static unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, uns
|
|||||||
{
|
{
|
||||||
const unsigned long ADLER_MOD = 65521;
|
const unsigned long ADLER_MOD = 65521;
|
||||||
unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;
|
unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;
|
||||||
unsigned long blocklen, i;
|
unsigned long blocklen = buflen % 5552;
|
||||||
|
|
||||||
blocklen = buflen % 5552;
|
unsigned long i;
|
||||||
while (buflen) {
|
while (buflen) {
|
||||||
for (i=0; i + 7 < blocklen; i += 8) {
|
for (i=0; i + 7 < blocklen; i += 8) {
|
||||||
s1 += buffer[0], s2 += s1;
|
s1 += buffer[0], s2 += s1;
|
||||||
@ -3230,10 +3230,9 @@ static unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, uns
|
|||||||
|
|
||||||
static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/)
|
static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/)
|
||||||
{
|
{
|
||||||
unsigned int olen;
|
|
||||||
if (stb__in4(0) != 0x57bC0000) return 0;
|
if (stb__in4(0) != 0x57bC0000) return 0;
|
||||||
if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
|
if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
|
||||||
olen = stb_decompress_length(i);
|
const unsigned int olen = stb_decompress_length(i);
|
||||||
stb__barrier_in_b = i;
|
stb__barrier_in_b = i;
|
||||||
stb__barrier_out_e = output + olen;
|
stb__barrier_out_e = output + olen;
|
||||||
stb__barrier_out_b = output;
|
stb__barrier_out_b = output;
|
||||||
|
@ -624,7 +624,7 @@ struct IMGUI_API ImGuiMenuColumns
|
|||||||
ImGuiMenuColumns();
|
ImGuiMenuColumns();
|
||||||
void Update(int count, float spacing, bool clear);
|
void Update(int count, float spacing, bool clear);
|
||||||
float DeclColumns(float w0, float w1, float w2);
|
float DeclColumns(float w0, float w1, float w2);
|
||||||
float CalcExtraSpace(float avail_w);
|
float CalcExtraSpace(float avail_w) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal state of the currently focused/edited text input box
|
// Internal state of the currently focused/edited text input box
|
||||||
|
@ -5990,7 +5990,7 @@ float ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using v
|
|||||||
return ImMax(Width, NextWidth);
|
return ImMax(Width, NextWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ImGuiMenuColumns::CalcExtraSpace(float avail_w)
|
float ImGuiMenuColumns::CalcExtraSpace(float avail_w) const
|
||||||
{
|
{
|
||||||
return ImMax(0.0f, avail_w - Width);
|
return ImMax(0.0f, avail_w - Width);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user