From a26570667150f15ef240eb2a1582af1a88e3ce41 Mon Sep 17 00:00:00 2001 From: Michael Theall Date: Tue, 7 Apr 2020 18:05:51 -0500 Subject: [PATCH] Use mulitply instead of divide where feasible --- source/3ds/imgui_citro3d.cpp | 2 +- source/ftpServer.cpp | 6 +++--- source/switch/imgui_deko3d.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/3ds/imgui_citro3d.cpp b/source/3ds/imgui_citro3d.cpp index 4f53957..40bdfc1 100644 --- a/source/3ds/imgui_citro3d.cpp +++ b/source/3ds/imgui_citro3d.cpp @@ -290,7 +290,7 @@ void imgui::citro3d::init () atlas->TexWidth = glyphInfo->sheetWidth; atlas->TexHeight = glyphInfo->sheetHeight * glyphInfo->nSheets; atlas->TexUvScale = ImVec2 (1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight); - atlas->TexUvWhitePixel = ImVec2 (0.5f / 8.0f, glyphInfo->nSheets + 0.5f / 8.0f); + atlas->TexUvWhitePixel = ImVec2 (0.5f * 0.125f, glyphInfo->nSheets + 0.5f * 0.125f); atlas->TexPixelsAlpha8 = static_cast (IM_ALLOC (1)); // dummy allocation // initialize font config diff --git a/source/ftpServer.cpp b/source/ftpServer.cpp index 133d2c0..f391219 100644 --- a/source/ftpServer.cpp +++ b/source/ftpServer.cpp @@ -74,7 +74,7 @@ void FtpServer::draw () ImGui::SetNextWindowPos (ImVec2 (0, 0), ImGuiCond_FirstUseEver); #ifdef _3DS // top screen - ImGui::SetNextWindowSize (ImVec2 (width, height / 2.0f)); + ImGui::SetNextWindowSize (ImVec2 (width, height * 0.5f)); #else ImGui::SetNextWindowSize (ImVec2 (width, height)); #endif @@ -123,8 +123,8 @@ void FtpServer::draw () ImGui::End (); // bottom screen - ImGui::SetNextWindowSize (ImVec2 (width * 0.8f, height / 2.0f)); - ImGui::SetNextWindowPos (ImVec2 (width * 0.1f, height / 2.0f), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize (ImVec2 (width * 0.8f, height * 0.5f)); + ImGui::SetNextWindowPos (ImVec2 (width * 0.1f, height * 0.5f), ImGuiCond_FirstUseEver); ImGui::Begin ("Sessions", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize); diff --git a/source/switch/imgui_deko3d.cpp b/source/switch/imgui_deko3d.cpp index 3f721ac..3548e1f 100644 --- a/source/switch/imgui_deko3d.cpp +++ b/source/switch/imgui_deko3d.cpp @@ -809,9 +809,9 @@ void imgui::deko3d::render () void imgui::deko3d::test () { - auto const x1 = (s_width - LOGO_WIDTH) / 2.0f; + auto const x1 = (s_width - LOGO_WIDTH) * 0.5f; auto const x2 = x1 + LOGO_WIDTH; - auto const y1 = (s_height - LOGO_HEIGHT) / 2.0f; + auto const y1 = (s_height - LOGO_HEIGHT) * 0.5f; auto const y2 = y1 + LOGO_HEIGHT; ImGui::GetBackgroundDrawList ()->AddImage (