summaryrefslogtreecommitdiffstats
path: root/sub/draw_bmp.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-21 05:56:55 +0100
committerwm4 <wm4@nowhere>2014-11-21 05:56:55 +0100
commit9a724f62ce54fa8eb9ee6872e770534e7f47201b (patch)
tree171e17132e63ada27fced25d99cceef1a8080adf /sub/draw_bmp.c
parent9df4e7c70e0c5e8e62ffcc30382614a7e300c79f (diff)
downloadmpv-9a724f62ce54fa8eb9ee6872e770534e7f47201b.tar.bz2
mpv-9a724f62ce54fa8eb9ee6872e770534e7f47201b.tar.xz
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.
Diffstat (limited to 'sub/draw_bmp.c')
-rw-r--r--sub/draw_bmp.c6
1 files changed, 3 insertions, 3 deletions
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;