summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-14 23:40:09 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-16 22:04:15 -0800
commit0dbad9503fd4fd2d9bc3ed443ad761eaf020fdef (patch)
tree3dc3cc9c4e9c7ea0132657dfc6a730e8196d8093
parentfca64d913b985d201bc4aa805cb51adf0e4fc5e0 (diff)
downloadmpv-0dbad9503fd4fd2d9bc3ed443ad761eaf020fdef.tar.bz2
mpv-0dbad9503fd4fd2d9bc3ed443ad761eaf020fdef.tar.xz
vo_gpu: hwdec_drmprime_drm: cosmetic simplification
Coverity complained about the redundant init of hratio etc. - just remove that and merge declaration/init of these variables. Also the first double cast in each expression is unnecessary.
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c
index e420bf4f33..69e9d1eb00 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/opengl/hwdec_drmprime_drm.c
@@ -91,15 +91,12 @@ static void set_current_frame(struct ra_hwdec *hw, struct drm_frame *frame)
static void scale_dst_rect(struct ra_hwdec *hw, int source_w, int source_h ,struct mp_rect *src, struct mp_rect *dst)
{
struct priv *p = hw->priv;
- double hratio, vratio, ratio;
// drm can allow to have a layer that has a different size from framebuffer
// we scale here the destination size to video mode
- hratio = vratio = ratio = 1.0;
-
- hratio = (double)p->display_w / (double)source_w;
- vratio = (double)p->display_h / (double)source_h;
- ratio = hratio <= vratio ? hratio : vratio;
+ double hratio = p->display_w / (double)source_w;
+ double vratio = p->display_h / (double)source_h;
+ double ratio = hratio <= vratio ? hratio : vratio;
dst->x0 = src->x0 * ratio;
dst->x1 = src->x1 * ratio;