aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--src/Body.cpp15
2 files changed, 10 insertions, 8 deletions
diff --git a/TODO b/TODO
index 4d83999..13f227e 100644
--- a/TODO
+++ b/TODO
@@ -222,4 +222,5 @@ Periodically cleanup old cache files (especially manga images, thumbnails and me
and if its X days old then check and remove old files again and update the file.
Render watch progress in youtube.
Set _NET_WM_USER_TIME (see sfml).
-Make saucenao work with encrypted images in matrix, or show an error as this is a "security" risk. \ No newline at end of file
+Make saucenao work with encrypted images in matrix, or show an error as this is a "security" risk.
+Body image cache (async image loader) should take requested size into consideration, because the same image can be requested at multiple sizes and we dont want to cache the smaller sized image for both. This happens on 4chan right now when navigating from the catalog page to a thread page and seeing OPs image. \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index 1451541..f9eb021 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1442,7 +1442,8 @@ namespace QuickMedia {
text_offset_x += body_spacing[body_theme].image_padding_x + item->loaded_image_size.x;
}
- const float text_max_width = size.x - text_offset_x;
+ const float image_padding_x = !draw_thumbnails ? 0.0f : body_spacing[body_theme].image_padding_x;
+ const float text_max_width = size.x - text_offset_x - image_padding_x;
const float text_offset_y = std::floor(6.0f * get_config().scale * get_config().font_scale);
const float timestamp_text_y = std::floor(item_pos.y + padding_y - text_offset_y - std::floor(4.0f * get_config().scale * get_config().font_scale));
@@ -1500,8 +1501,8 @@ namespace QuickMedia {
reaction_max_height = std::max(reaction_max_height, reaction.size.y);
reaction_background.set_size(mgl::vec2f(reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f, reaction.size.y + body_spacing[body_theme].reaction_background_padding_y * 2.0f));
- const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x;
- if(i != 0 && (text_offset_x + new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) {
+ const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f;
+ if(i != 0 && (new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) {
reaction_offset_x = 0.0f;
item_pos.y += reaction_max_height_prev + body_spacing[body_theme].reaction_padding_y + text_offset_y;
reaction_max_height = reaction.size.y;
@@ -1509,7 +1510,7 @@ namespace QuickMedia {
reaction_offset_x = reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x;
} else {
reaction_background.set_position(vec2f_floor(item_pos.x + text_offset_x + reaction_offset_x, item_pos.y + padding_y));
- reaction_offset_x = new_reaction_offset_x;
+ reaction_offset_x = new_reaction_offset_x + body_spacing[body_theme].reaction_spacing_x;
}
if(reaction.text) {
@@ -1735,13 +1736,13 @@ namespace QuickMedia {
const float reaction_max_height_prev = reaction_max_height;
reaction_max_height = std::max(reaction_max_height, reaction.size.y);
- const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x;
- if(i != 0 && (text_offset_x + new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) {
+ const float new_reaction_offset_x = reaction_offset_x + reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f;
+ if(i != 0 && (new_reaction_offset_x > text_max_width || reaction.num_lines > 1)) {
item_height += reaction_max_height_prev + body_spacing[body_theme].reaction_padding_y + std::floor(6.0f * get_config().scale);
reaction_max_height = reaction.size.y;
reaction_offset_x = reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f + body_spacing[body_theme].reaction_spacing_x;
} else {
- reaction_offset_x = new_reaction_offset_x;
+ reaction_offset_x = new_reaction_offset_x + body_spacing[body_theme].reaction_spacing_x;
}
}
item_height += reaction_max_height + body_spacing[body_theme].reaction_padding_y;