mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
ImDrawList: AddImageRounded() compare texid from cmdheader as with other functions. + Made the ImGuiMemAllocFunc / ImGuiMemFreeFunc consistent with our other typedefs (#3836)
This commit is contained in:
parent
8dd692c29c
commit
3e6dfd3c1a
13
imgui.cpp
13
imgui.cpp
@ -946,8 +946,8 @@ static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_d
|
|||||||
static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; }
|
static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; }
|
||||||
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); }
|
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); }
|
||||||
#endif
|
#endif
|
||||||
static ImGuiMemAllocFunc* GImAllocatorAllocFunc = MallocWrapper;
|
static ImGuiMemAllocFunc GImAllocatorAllocFunc = MallocWrapper;
|
||||||
static ImGuiMemFreeFunc* GImAllocatorFreeFunc = FreeWrapper;
|
static ImGuiMemFreeFunc GImAllocatorFreeFunc = FreeWrapper;
|
||||||
static void* GImAllocatorUserData = NULL;
|
static void* GImAllocatorUserData = NULL;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -3290,7 +3290,7 @@ void* ImGui::MemAlloc(size_t size)
|
|||||||
{
|
{
|
||||||
if (ImGuiContext* ctx = GImGui)
|
if (ImGuiContext* ctx = GImGui)
|
||||||
ctx->IO.MetricsActiveAllocations++;
|
ctx->IO.MetricsActiveAllocations++;
|
||||||
return GImAllocatorAllocFunc(size, GImAllocatorUserData);
|
return (*GImAllocatorAllocFunc)(size, GImAllocatorUserData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IM_FREE() == ImGui::MemFree()
|
// IM_FREE() == ImGui::MemFree()
|
||||||
@ -3299,7 +3299,7 @@ void ImGui::MemFree(void* ptr)
|
|||||||
if (ptr)
|
if (ptr)
|
||||||
if (ImGuiContext* ctx = GImGui)
|
if (ImGuiContext* ctx = GImGui)
|
||||||
ctx->IO.MetricsActiveAllocations--;
|
ctx->IO.MetricsActiveAllocations--;
|
||||||
return GImAllocatorFreeFunc(ptr, GImAllocatorUserData);
|
return (*GImAllocatorFreeFunc)(ptr, GImAllocatorUserData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ImGui::GetClipboardText()
|
const char* ImGui::GetClipboardText()
|
||||||
@ -3336,7 +3336,7 @@ void ImGui::SetCurrentContext(ImGuiContext* ctx)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc* alloc_func, ImGuiMemFreeFunc* free_func, void* user_data)
|
void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data)
|
||||||
{
|
{
|
||||||
GImAllocatorAllocFunc = alloc_func;
|
GImAllocatorAllocFunc = alloc_func;
|
||||||
GImAllocatorFreeFunc = free_func;
|
GImAllocatorFreeFunc = free_func;
|
||||||
@ -3344,7 +3344,7 @@ void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc* alloc_func, ImGuiMemFreeFun
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space)
|
// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space)
|
||||||
void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc** p_alloc_func, ImGuiMemFreeFunc** p_free_func, void** p_user_data)
|
void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data)
|
||||||
{
|
{
|
||||||
*p_alloc_func = GImAllocatorAllocFunc;
|
*p_alloc_func = GImAllocatorAllocFunc;
|
||||||
*p_free_func = GImAllocatorFreeFunc;
|
*p_free_func = GImAllocatorFreeFunc;
|
||||||
@ -6432,6 +6432,7 @@ void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWind
|
|||||||
FocusWindow(NULL);
|
FocusWindow(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Important: this alone doesn't alter current ImDrawList state. This is called by PushFont/PopFont only.
|
||||||
void ImGui::SetCurrentFont(ImFont* font)
|
void ImGui::SetCurrentFont(ImFont* font)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
8
imgui.h
8
imgui.h
@ -194,8 +194,8 @@ typedef void* ImTextureID; // User data for rendering backend to identi
|
|||||||
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
||||||
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
||||||
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
||||||
typedef void* (ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
typedef void (ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
|
|
||||||
// Character types
|
// Character types
|
||||||
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
||||||
@ -875,8 +875,8 @@ namespace ImGui
|
|||||||
// - Those functions are not reliant on the current context.
|
// - Those functions are not reliant on the current context.
|
||||||
// - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
// - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
||||||
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
||||||
IMGUI_API void SetAllocatorFunctions(ImGuiMemAllocFunc* alloc_func, ImGuiMemFreeFunc* free_func, void* user_data = NULL);
|
IMGUI_API void SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data = NULL);
|
||||||
IMGUI_API void GetAllocatorFunctions(ImGuiMemAllocFunc** p_alloc_func, ImGuiMemFreeFunc** p_free_func, void** p_user_data);
|
IMGUI_API void GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data);
|
||||||
IMGUI_API void* MemAlloc(size_t size);
|
IMGUI_API void* MemAlloc(size_t size);
|
||||||
IMGUI_API void MemFree(void* ptr);
|
IMGUI_API void MemFree(void* ptr);
|
||||||
|
|
||||||
|
@ -1461,7 +1461,7 @@ void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_mi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();
|
const bool push_texture_id = user_texture_id != _CmdHeader.TextureId;
|
||||||
if (push_texture_id)
|
if (push_texture_id)
|
||||||
PushTextureID(user_texture_id);
|
PushTextureID(user_texture_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user