From 5d779bb36c176e1d1ecafdd49e62f4708a4aa448 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 18 Jan 2025 14:33:29 +0100 Subject: [PATCH] fixes post imgui update --- src/chat_gui/send_image_popup.cpp | 4 ++-- src/chat_gui/texture_cache_defs.hpp | 7 ++++--- src/chat_gui4.hpp | 5 +---- src/debug_video_tap.cpp | 2 +- src/main_screen.hpp | 7 +++---- src/texture_cache.hpp | 3 ++- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/chat_gui/send_image_popup.cpp b/src/chat_gui/send_image_popup.cpp index 1764606..14903b1 100644 --- a/src/chat_gui/send_image_popup.cpp +++ b/src/chat_gui/send_image_popup.cpp @@ -259,7 +259,7 @@ void SendImagePopup::render(float time_delta) { if (cropping) { // if cropping // display full image ImGui::Image( - preview_image.getID(), + preview_image.getID(), ImVec2{static_cast(width), static_cast(height)} ); const auto post_img_curser = ImGui::GetCursorPos(); @@ -407,7 +407,7 @@ void SendImagePopup::render(float time_delta) { // display cropped area ImGui::Image( - preview_image.getID(), + preview_image.getID(), ImVec2{static_cast(width), static_cast(height)}, ImVec2{float(crop_rect.x)/original_image.width, float(crop_rect.y)/original_image.height}, ImVec2{float(crop_rect.x+crop_rect.w)/original_image.width, float(crop_rect.y+crop_rect.h)/original_image.height} diff --git a/src/chat_gui/texture_cache_defs.hpp b/src/chat_gui/texture_cache_defs.hpp index e3797b4..fc360b3 100644 --- a/src/chat_gui/texture_cache_defs.hpp +++ b/src/chat_gui/texture_cache_defs.hpp @@ -5,8 +5,9 @@ #include "../texture_cache.hpp" #include "../tox_avatar_loader.hpp" #include "../message_image_loader.hpp" +#include "../bitset_image_loader.hpp" - -using ContactTextureCache = TextureCache; -using MessageTextureCache = TextureCache; +using ContactTextureCache = TextureCache; +using MessageTextureCache = TextureCache; +using BitsetTextureCache = TextureCache; diff --git a/src/chat_gui4.hpp b/src/chat_gui4.hpp index a60aacb..126576a 100644 --- a/src/chat_gui4.hpp +++ b/src/chat_gui4.hpp @@ -5,6 +5,7 @@ #include #include "./chat_gui/theme.hpp" +#include "./chat_gui/texture_cache_defs.hpp" #include "./texture_uploader.hpp" #include "./texture_cache.hpp" @@ -22,10 +23,6 @@ #include #include -using ContactTextureCache = TextureCache; -using MessageTextureCache = TextureCache; -using BitsetTextureCache = TextureCache; - class ChatGui4 : public ObjectStoreEventI { ConfigModelI& _conf; ObjectStore2& _os; diff --git a/src/debug_video_tap.cpp b/src/debug_video_tap.cpp index 9d5fb1f..8e3bc48 100644 --- a/src/debug_video_tap.cpp +++ b/src/debug_video_tap.cpp @@ -252,7 +252,7 @@ float DebugVideoTap::render(void) { ImGui::Text("%dx%d interval: ~%.0fms (%.2ffps)", view._tex_w, view._tex_h, view._v_interval_avg*1000.f, 1.f/view._v_interval_avg); const float img_w = ImGui::GetContentRegionAvail().x; ImGui::Image( - reinterpret_cast(view._tex), + static_cast(static_cast(view._tex)), ImVec2{img_w, img_w * float(view._tex_h)/view._tex_w}, ImVec2{view._mirror?1.f:0.f, 0}, ImVec2{view._mirror?0.f:1.f, 1} diff --git a/src/main_screen.hpp b/src/main_screen.hpp index 55c14a7..a339f64 100644 --- a/src/main_screen.hpp +++ b/src/main_screen.hpp @@ -26,8 +26,7 @@ #include "./sdlrenderer_texture_uploader.hpp" #include "./texture_cache.hpp" -#include "./tox_avatar_loader.hpp" -#include "./message_image_loader.hpp" +#include "./chat_gui/texture_cache_defs.hpp" #include "./sys_tray.hpp" #include "./status_indicator.hpp" @@ -89,9 +88,9 @@ struct MainScreen final : public Screen { //OpenGLTextureUploader ogltu; ToxAvatarLoader tal; - TextureCache contact_tc; + ContactTextureCache contact_tc; MessageImageLoader mil; - TextureCache msg_tc; + MessageTextureCache msg_tc; std::unique_ptr st; StatusIndicator si; diff --git a/src/texture_cache.hpp b/src/texture_cache.hpp index 302a679..860c39c 100644 --- a/src/texture_cache.hpp +++ b/src/texture_cache.hpp @@ -69,7 +69,8 @@ struct TextureEntry { rendered_this_frame = true; assert(current_texture < textures.size()); if constexpr (sizeof(TextureType) == sizeof(uint64_t)) { - return reinterpret_cast(textures.at(current_texture)); + //return reinterpret_cast(textures.at(current_texture)); + return static_cast(static_cast(textures.at(current_texture))); } else if constexpr (sizeof(TextureType) == sizeof(uint32_t)) { return reinterpret_cast(static_cast(textures.at(current_texture))); }