]> git.nihav.org Git - nihav-player.git/commitdiff
videoplayer: handle down-scaling with SDL properly too master
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 28 Apr 2026 17:09:27 +0000 (19:09 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 28 Apr 2026 17:09:27 +0000 (19:09 +0200)
videoplayer/src/main.rs

index eac789fd8ec53f93ac13e6a5099bad230a623cc9..ffc54ab53bac7d899be6114c6c9723d5f9913efb 100644 (file)
@@ -325,8 +325,8 @@ pub struct DispQueue<'a> {
 }
 
 impl<'a> DispQueue<'a> {
-    fn new(texture_creator: &'a TextureCreator<WindowContext>, width: usize, height: usize, len: usize) -> Self {
-        let pool = SDLPool::new(texture_creator, width, height, len);
+    fn new(texture_creator: &'a TextureCreator<WindowContext>, width: usize, height: usize, orig_w: usize, orig_h: usize, len: usize) -> Self {
+        let pool = SDLPool::new(texture_creator, orig_w, orig_h, len);
 
         let mut empty_tex = texture_creator.create_texture_streaming(PixelFormatEnum::RGB24, width as u32, height as u32).expect("failed to create RGB texture");
         empty_tex.with_lock(None, |buffer: &mut [u8], _pitch: usize| {
@@ -995,7 +995,7 @@ impl Player {
         window.show();
         let mut canvas = window.into_canvas().build().expect("should be able to build canvas");
         let texture_creator = canvas.texture_creator();
-        let mut disp_q = DispQueue::new(&texture_creator, width, height, if self.has_video { FRAME_QUEUE_LEN } else { 0 });
+        let mut disp_q = DispQueue::new(&texture_creator, width, height, dec_w, dec_h, if self.has_video { FRAME_QUEUE_LEN } else { 0 });
         if !self.has_video {
             canvas.clear();
             canvas.copy(disp_q.get_last_texture(), None, None).expect("blit failure");