From 9a724f62ce54fa8eb9ee6872e770534e7f47201b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 21 Nov 2014 05:56:55 +0100 Subject: draw_bmp: make code more obvious, remove assertion Silences a Coverity warning. Also, drop the assert(); although it should be pretty much guaranteed that things happen this way, it's still a bit fuzzy. --- sub/draw_bmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sub') diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 02b7f9ec20..041e0a70e0 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -296,7 +296,8 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb, cspar.int_bits_out = 8; float yuv2rgb[3][4], rgb2yuv[3][4]; - if (temp->flags & MP_IMGFLAG_YUV) { + bool need_conv = temp->flags & MP_IMGFLAG_YUV; + if (need_conv) { mp_get_yuv2rgb_coeffs(&cspar, yuv2rgb); mp_invert_yuv2rgb(rgb2yuv, yuv2rgb); } @@ -314,10 +315,9 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb, int b = (sb->libass.color >> 8) & 0xFF; int a = 255 - (sb->libass.color & 0xFF); int color_yuv[3] = {r, g, b}; - if (dst.flags & MP_IMGFLAG_YUV) { + if (need_conv) { mp_map_int_color(rgb2yuv, bits, color_yuv); } else { - assert(dst.imgfmt == IMGFMT_GBRP); color_yuv[0] = g; color_yuv[1] = b; color_yuv[2] = r; -- cgit v1.2.3