mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
9df4e7c70e
commit
9a724f62ce
|
@ -296,7 +296,8 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb,
|
||||||
cspar.int_bits_out = 8;
|
cspar.int_bits_out = 8;
|
||||||
|
|
||||||
float yuv2rgb[3][4], rgb2yuv[3][4];
|
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_get_yuv2rgb_coeffs(&cspar, yuv2rgb);
|
||||||
mp_invert_yuv2rgb(rgb2yuv, 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 b = (sb->libass.color >> 8) & 0xFF;
|
||||||
int a = 255 - (sb->libass.color & 0xFF);
|
int a = 255 - (sb->libass.color & 0xFF);
|
||||||
int color_yuv[3] = {r, g, b};
|
int color_yuv[3] = {r, g, b};
|
||||||
if (dst.flags & MP_IMGFLAG_YUV) {
|
if (need_conv) {
|
||||||
mp_map_int_color(rgb2yuv, bits, color_yuv);
|
mp_map_int_color(rgb2yuv, bits, color_yuv);
|
||||||
} else {
|
} else {
|
||||||
assert(dst.imgfmt == IMGFMT_GBRP);
|
|
||||||
color_yuv[0] = g;
|
color_yuv[0] = g;
|
||||||
color_yuv[1] = b;
|
color_yuv[1] = b;
|
||||||
color_yuv[2] = r;
|
color_yuv[2] = r;
|
||||||
|
|
Loading…
Reference in New Issue