[fractal/fractal-next] message-media: Use bigger thumbnails



commit ada576b5ac44005dd311f68359917dcf0c36c0b6
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Mon Dec 13 16:46:51 2021 +0100

    message-media: Use bigger thumbnails
    
    See #26

 src/session/content/room_history/message_row/media.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/session/content/room_history/message_row/media.rs 
b/src/session/content/room_history/message_row/media.rs
index fd245f0d..bab06e6c 100644
--- a/src/session/content/room_history/message_row/media.rs
+++ b/src/session/content/room_history/message_row/media.rs
@@ -27,8 +27,10 @@ use crate::{
     utils::{cache_dir, uint_to_i32},
 };
 
-const MAX_THUMBNAIL_WIDTH: i32 = 320;
-const MAX_THUMBNAIL_HEIGHT: i32 = 240;
+const MAX_THUMBNAIL_WIDTH: i32 = 600;
+const MAX_THUMBNAIL_HEIGHT: i32 = 400;
+const FALLBACK_WIDTH: i32 = 480;
+const FALLBACK_HEIGHT: i32 = 360;
 
 #[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
 #[repr(u32)]
@@ -166,11 +168,12 @@ mod imp {
             let original_width = self.width.get();
             let original_height = self.height.get();
 
-            let (original, max, original_other, max_other) =
+            let (original, max, fallback, original_other, max_other) =
                 if orientation == gtk::Orientation::Vertical {
                     (
                         original_height,
                         MAX_THUMBNAIL_HEIGHT,
+                        FALLBACK_HEIGHT,
                         original_width,
                         MAX_THUMBNAIL_WIDTH,
                     )
@@ -178,6 +181,7 @@ mod imp {
                     (
                         original_width,
                         MAX_THUMBNAIL_WIDTH,
+                        FALLBACK_WIDTH,
                         original_height,
                         MAX_THUMBNAIL_HEIGHT,
                     )
@@ -194,7 +198,7 @@ mod imp {
                 // Get the natural size of the data.
                 child.measure(orientation, other).1
             } else {
-                max
+                fallback
             };
 
             // Limit this size to 400 pixels.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]