diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-20 13:11:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-20 13:11:59 +0200 |
commit | c1db97f057e8f20aa26a2342da94eeff1d7a7725 (patch) | |
tree | b795e75ba14bb2b9cab0fbc6aad01cd76b892939 /src/QuickMedia.cpp | |
parent | 5465c09cd108e37720dbad139de98bdcf5dfe8bf (diff) |
Proper atomic rename? also do not generate mipmap for manga
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 37c5223..8d02b95 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -53,7 +53,7 @@ static const sf::Color back_color(21, 25, 30); static const std::string fourchan_google_captcha_api_key = "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc"; static int FPS_IDLE = 2; static const double IDLE_TIMEOUT_SEC = 2.0; -static const sf::Vector2i AVATAR_THUMBNAIL_SIZE(std::floor(32 * QuickMedia::get_ui_scale()), std::floor(32 * QuickMedia::get_ui_scale())); +static const sf::Vector2i AVATAR_THUMBNAIL_SIZE(std::floor(32), std::floor(32)); static const std::pair<const char*, const char*> valid_plugins[] = { std::make_pair("launcher", nullptr), @@ -563,12 +563,12 @@ namespace QuickMedia { if(exec_program(args, nullptr, nullptr) != 0) { fprintf(stderr, "Warning: failed to upscale %s with waifu2x-ncnn-vulkan\n", copy_op.source.data.c_str()); // No conversion, but we need the file to have the destination name to see that the operation completed (and read it) - if(rename(copy_op.source.data.c_str(), copy_op.destination.data.c_str()) != 0) + if(rename_atomic(copy_op.source.data.c_str(), copy_op.destination.data.c_str()) != 0) perror(tmp_file.data.c_str()); continue; } - if(rename(tmp_file.data.c_str(), copy_op.destination.data.c_str()) != 0) + if(rename_atomic(tmp_file.data.c_str(), copy_op.destination.data.c_str()) != 0) perror(tmp_file.data.c_str()); copy_op.destination.append(".upscaled"); @@ -2390,7 +2390,7 @@ namespace QuickMedia { if(load_image_from_file(image, image_path.data)) { if(image_texture.loadFromImage(image)) { image_texture.setSmooth(true); - image_texture.generateMipmap(); + //image_texture.generateMipmap(); return LoadImageResult::OK; } else { error_message = std::string("Failed to load image for page ") + std::to_string(image_index + 1); @@ -2509,7 +2509,7 @@ namespace QuickMedia { } if(rename_immediately) { - if(rename(image_filepath_tmp.data.c_str(), image_filepath.data.c_str()) != 0) { + if(rename_atomic(image_filepath_tmp.data.c_str(), image_filepath.data.c_str()) != 0) { perror(image_filepath_tmp.data.c_str()); show_notification("QuickMedia", "Failed to save image to file: " + image_filepath.data, Urgency::CRITICAL); return true; @@ -4951,7 +4951,7 @@ namespace QuickMedia { float room_name_padding_y = 0.0f; float padding_bottom = 0.0f; if(selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX) { - room_name_padding_y = 10.0f + room_name_total_height; + room_name_padding_y = std::floor(10.0f * get_ui_scale() + room_name_total_height); tab_vertical_offset = std::floor(10.0f * get_ui_scale()); } |