From 935b07603e7baf2ee8fc44c4c39bcd9638df5a24 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Thu, 10 Sep 2020 13:37:36 +0200 Subject: [PATCH] Adjust the preload value to account for 4-byte floats --- editor/src/editor/Editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/src/editor/Editor.cpp b/editor/src/editor/Editor.cpp index 794eb331..35772396 100644 --- a/editor/src/editor/Editor.cpp +++ b/editor/src/editor/Editor.cpp @@ -565,14 +565,14 @@ void Editor::Impl::createFrameContents() for (int log2value = 10; log2value <= 16; ++log2value) { int value = 1 << log2value; char text[256]; - sprintf(text, "%d kB", value / 1024); + sprintf(text, "%d kB", value / 1024 * 4); text[sizeof(text) - 1] = '\0'; preloadSizeSlider_->addEntry(text, value); } preloadSizeSlider_->setValueToStringFunction2( [](float value, std::string& result, CParamDisplay*) -> bool { - result = std::to_string(static_cast(std::round(value * (1.0 / 1024)))) + " kB"; + result = std::to_string(static_cast(std::round(value * (1.0 / 1024 * 4)))) + " kB"; return true; });