[vlc-commits] vout_subpicture: fix cropping

Francois Cartegnie git at videolan.org
Fri Jan 5 15:49:32 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan  2 21:41:37 2018 +0100| [90fafb4b2d7b50d9a14b5bf163d43cec10b9dfe2] | committer: Jean-Baptiste Kempf

vout_subpicture: fix cropping

(cherry picked from commit f03f900c1d5955f2d75dc6113c470e3fc5127c61)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=90fafb4b2d7b50d9a14b5bf163d43cec10b9dfe2
---

 src/video_output/vout_subpictures.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 50c358be04..5524347887 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -905,10 +905,10 @@ static void SpuRenderRegion(spu_t *spu,
     if (crop_requested) {
         int crop_x, crop_y, crop_width, crop_height;
         if(sys->force_crop){
-            crop_x     = sys->crop.x;
-            crop_y     = sys->crop.y;
-            crop_width = sys->crop.width;
-            crop_height= sys->crop.height;
+            crop_x     = spu_scale_w(sys->crop.x, scale_size);
+            crop_y     = spu_scale_h(sys->crop.y, scale_size);
+            crop_width = spu_scale_w(sys->crop.width,  scale_size);
+            crop_height= spu_scale_h(sys->crop.height, scale_size);
         }
         else
         {
@@ -918,16 +918,11 @@ static void SpuRenderRegion(spu_t *spu,
             crop_height = region_fmt.i_visible_height;
         }
 
-        if(region->i_max_width && region->i_max_width < crop_width)
-            crop_width = region->i_max_width;
+        if(region->i_max_width && spu_scale_w(region->i_max_width, scale_size) < crop_width)
+            crop_width = spu_scale_w(region->i_max_width, scale_size);
 
-        if(region->i_max_height && region->i_max_height < crop_height)
-            crop_height = region->i_max_height;
-
-        crop_x     = spu_scale_w(crop_x,     scale_size);
-        crop_y     = spu_scale_h(crop_y,     scale_size);
-        crop_width = spu_scale_w(crop_width, scale_size);
-        crop_height= spu_scale_h(crop_height,scale_size);
+        if(region->i_max_height && spu_scale_h(region->i_max_height, scale_size) < crop_height)
+            crop_height = spu_scale_h(region->i_max_height, scale_size);
 
         /* Find the intersection */
         if (crop_x + crop_width <= x_offset ||



More information about the vlc-commits mailing list