Skip to content

Commit 740f52d

Browse files
committed
Use uintptr_t reinterpret_cast for Metal textures
Include imiv_viewer.h and update texture pointer-to-ID conversions to use reinterpret_cast<uintptr_t> instead of static_cast<intptr_t>. This replaces signed intptr_t casts with an unsigned uintptr_t and a reinterpret_cast for both main and closeup Metal texture refs to ensure correct pointer-to-integer conversion and improve portability.
1 parent de5ace1 commit 740f52d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/imiv/imiv_renderer_metal.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "imiv_renderer_backend.h"
66

77
#include "imiv_platform_glfw.h"
8+
#include "imiv_viewer.h"
89

910
#include <imgui_impl_metal.h>
1011

@@ -427,7 +428,7 @@
427428
main_texture = state->preview_linear_texture;
428429
if (main_texture != nil) {
429430
main_texture_ref = ImTextureRef(static_cast<ImTextureID>(
430-
static_cast<intptr_t>((__bridge void*)main_texture)));
431+
reinterpret_cast<uintptr_t>((__bridge void*)main_texture)));
431432
has_main_texture = true;
432433
}
433434

@@ -436,7 +437,7 @@
436437
closeup_texture = state->preview_linear_texture;
437438
if (closeup_texture != nil) {
438439
closeup_texture_ref = ImTextureRef(static_cast<ImTextureID>(
439-
static_cast<intptr_t>((__bridge void*)closeup_texture)));
440+
reinterpret_cast<uintptr_t>((__bridge void*)closeup_texture)));
440441
has_closeup_texture = true;
441442
}
442443
return has_main_texture || has_closeup_texture;

0 commit comments

Comments
 (0)