From 4ae711eb3ca9157cf90de946517a1a2726d27024 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 24 Sep 2021 05:28:29 +0200 Subject: Show failed to load youtube subscriptions first, floor 4chan image for better quality after moving it --- src/QuickMedia.cpp | 8 ++++++-- src/plugins/Youtube.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 9122108..9483d6b 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3797,6 +3797,10 @@ namespace QuickMedia { return sf::Vector2f(vec.x, vec.y); } + static sf::Vector2f floor(sf::Vector2f vec) { + return { std::floor(vec.x), std::floor(vec.y) }; + } + void Program::image_board_thread_page(ImageBoardThreadPage *thread_page, Body *thread_body) { // TODO: Instead of using stage here, use different pages for each stage enum class NavigationStage { @@ -4439,9 +4443,9 @@ namespace QuickMedia { } else if(navigation_stage == NavigationStage::VIEWING_ATTACHED_IMAGE) { if(attached_image_texture->getNativeHandle() != 0) { if(image_control.moved) { - attached_image_sprite.setOrigin(image_control.offset); + attached_image_sprite.setOrigin(floor(image_control.offset)); attached_image_sprite.setScale(image_control.zoom, image_control.zoom); - attached_image_sprite.setPosition(window_size * 0.5f); + attached_image_sprite.setPosition(floor(window_size * 0.5f)); window.draw(attached_image_sprite); } else { auto content_size = window_size; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 06e030b..012a20b 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -1690,7 +1690,7 @@ namespace QuickMedia { DownloadResult result = download_to_string("https://www.youtube.com/feeds/videos.xml?channel_id=" + url_param_encode(channel_id), website_data, {}, false); if(result != DownloadResult::OK) { auto body_item = BodyItem::create("Failed to fetch videos for channel: " + channel_id); - return {YoutubeSubscriptionTaskResult{body_item, 0}}; + return {YoutubeSubscriptionTaskResult{body_item, time_now}}; } SubscriptionData subscription_data; -- cgit v1.2.3