We can do integer math ... as long as sizes are smaller than 2**16 we should be ok :)
authorAntoine Cellerier <dionoea@videolan.org>
Wed, 2 Apr 2008 19:51:34 +0000 (21:51 +0200)
committerAntoine Cellerier <dionoea@videolan.org>
Wed, 2 Apr 2008 19:51:34 +0000 (21:51 +0200)
src/video_output/vout_intf.c

index ecee0b2..516c9e1 100644 (file)
@@ -724,13 +724,11 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
 
     if( fmt_out.i_width == 0 && fmt_out.i_height > 0 )
     {
-        float f = (float)fmt_in.i_height / fmt_out.i_height;
-        fmt_out.i_width = fmt_in.i_width / f;
+        fmt_out.i_width = (fmt_in.i_width * fmt_out.i_height) / fmt_in.i_height;
     }
     else if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
     {
-        float f = (float)fmt_in.i_width / fmt_out.i_width;
-        fmt_out.i_height = fmt_in.i_height / f;
+        fmt_out.i_height = (fmt_in.i_height * fmt_out.i_width) / fmt_in.i_width;
     }
     else
     {