[clutter-gst] aspectratio: fix aspect ratio with fill_allocation case



commit 7999e887a9c18aa69dec49f73577c04e1f22321c
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Mon Jun 9 19:30:44 2014 +0100

    aspectratio: fix aspect ratio with fill_allocation case

 clutter-gst/clutter-gst-aspectratio.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-aspectratio.c b/clutter-gst/clutter-gst-aspectratio.c
index a31eb0e..802920f 100644
--- a/clutter-gst/clutter-gst-aspectratio.c
+++ b/clutter-gst/clutter-gst-aspectratio.c
@@ -114,10 +114,10 @@ clutter_gst_aspectratio_get_frame_box (ClutterGstAspectratio *self,
         }
     }
 
-  paint_box->x1 = (actor_width - new_width) / 2;
-  paint_box->y1 = (actor_height - new_height) / 2;
-  paint_box->x2 = paint_box->x1 + new_width;
-  paint_box->y2 = paint_box->y1 + new_height;
+  paint_box->x1 = MAX ((actor_width - new_width) / 2, 0);
+  paint_box->y1 = MAX ((actor_height - new_height) / 2, 0);
+  paint_box->x2 = MIN (paint_box->x1 + new_width, actor_width);
+  paint_box->y2 = MIN (paint_box->y1 + new_height, actor_height);
 
   if (priv->fill_allocation)
     {


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