From 1eb89d7e3b6960edbbb0276581a6f26617e717f4 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 8 Mar 2018 20:32:34 +0100 Subject: [PATCH] Viewport: Changed signature of ResizeViewport to be consistent with other similar functions. --- examples/imgui_impl_dx10.cpp | 4 ++-- examples/imgui_impl_dx11.cpp | 4 ++-- examples/imgui_impl_vulkan.cpp | 5 ++--- examples/imgui_impl_win32.cpp | 2 +- imgui.h | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/imgui_impl_dx10.cpp b/examples/imgui_impl_dx10.cpp index fd41922f..980f3342 100644 --- a/examples/imgui_impl_dx10.cpp +++ b/examples/imgui_impl_dx10.cpp @@ -566,7 +566,7 @@ static void ImGui_ImplDX10_DestroyViewport(ImGuiViewport* viewport) viewport->RendererUserData = NULL; } -static void ImGui_ImplDX10_ResizeViewport(ImGuiViewport* viewport, int w, int h) +static void ImGui_ImplDX10_ResizeViewport(ImGuiViewport* viewport, ImVec2 size) { ImGuiPlatformDataDx10* data = (ImGuiPlatformDataDx10*)viewport->RendererUserData; if (data->RTView) @@ -577,7 +577,7 @@ static void ImGui_ImplDX10_ResizeViewport(ImGuiViewport* viewport, int w, int h) if (data->SwapChain) { ID3D10Texture2D* pBackBuffer = NULL; - data->SwapChain->ResizeBuffers(0, w, h, DXGI_FORMAT_UNKNOWN, 0); + data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0); data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView); pBackBuffer->Release(); diff --git a/examples/imgui_impl_dx11.cpp b/examples/imgui_impl_dx11.cpp index 42aed695..719025a0 100644 --- a/examples/imgui_impl_dx11.cpp +++ b/examples/imgui_impl_dx11.cpp @@ -574,7 +574,7 @@ static void ImGui_ImplDX11_DestroyViewport(ImGuiViewport* viewport) viewport->RendererUserData = NULL; } -static void ImGui_ImplDX11_ResizeViewport(ImGuiViewport* viewport, int w, int h) +static void ImGui_ImplDX11_ResizeViewport(ImGuiViewport* viewport, ImVec2 size) { ImGuiPlatformDataDx11* data = (ImGuiPlatformDataDx11*)viewport->RendererUserData; if (data->RTView) @@ -585,7 +585,7 @@ static void ImGui_ImplDX11_ResizeViewport(ImGuiViewport* viewport, int w, int h) if (data->SwapChain) { ID3D11Texture2D* pBackBuffer = NULL; - data->SwapChain->ResizeBuffers(0, w, h, DXGI_FORMAT_UNKNOWN, 0); + data->SwapChain->ResizeBuffers(0, (UINT)size.x, (UINT)size.y, DXGI_FORMAT_UNKNOWN, 0); data->SwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &data->RTView); pBackBuffer->Release(); diff --git a/examples/imgui_impl_vulkan.cpp b/examples/imgui_impl_vulkan.cpp index a013e384..839d737c 100644 --- a/examples/imgui_impl_vulkan.cpp +++ b/examples/imgui_impl_vulkan.cpp @@ -1055,13 +1055,12 @@ static void ImGui_ImplVulkan_DestroyViewport(ImGuiViewport* viewport) viewport->RendererUserData = NULL; } -static void ImGui_ImplVulkan_ResizeViewport(ImGuiViewport* viewport, int w, int h) +static void ImGui_ImplVulkan_ResizeViewport(ImGuiViewport* viewport, ImVec2 size) { ImGuiPlatformDataVulkan* data = (ImGuiPlatformDataVulkan*)viewport->RendererUserData; //... (void)data; - (void)w; - (void)h; + (void)size; } static void ImGui_ImplVulkan_RenderViewport(ImGuiViewport* viewport) diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index 1c82cb71..c02bfad9 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -418,7 +418,7 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd, if (!data->ExternalResize) viewport->PlatformRequestResize = true; if (io.RendererInterface.ResizeViewport) - io.RendererInterface.ResizeViewport(viewport, (int)LOWORD(lParam), (int)HIWORD(lParam)); + io.RendererInterface.ResizeViewport(viewport, ImVec2((float)LOWORD(lParam), (float)HIWORD(lParam))); break; } } diff --git a/imgui.h b/imgui.h index a31a7b1f..cff33252 100644 --- a/imgui.h +++ b/imgui.h @@ -973,7 +973,7 @@ struct ImGuiRendererInterface { void (*CreateViewport)(ImGuiViewport* viewport); void (*DestroyViewport)(ImGuiViewport* viewport); - void (*ResizeViewport)(ImGuiViewport* viewport, int w, int h); + void (*ResizeViewport)(ImGuiViewport* viewport, ImVec2 size); void (*RenderViewport)(ImGuiViewport* viewport); // Setup render output, clear targets, call Renderer_RenderDrawData void (*SwapBuffers)(ImGuiViewport* viewport); // Call Present/SwapBuffers };