0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

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.
This commit is contained in:
wm4 2018-02-14 23:40:09 +01:00 committed by Kevin Mitchell
parent fca64d913b
commit 0dbad9503f

View File

@ -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;