diff options
author | wm4 <wm4@nowhere> | 2013-08-09 22:59:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-08-12 00:50:28 +0200 |
commit | 689a25003fc8098e5fdfbb2faefc0e18365d3acb (patch) | |
tree | 1735960be82a994c75549e4c5c45a88f1bc9ea8c /sub/sub.c | |
parent | 8fe4790ec8945cae52ea7600312f54e1dbdf8162 (diff) | |
download | mpv-689a25003fc8098e5fdfbb2faefc0e18365d3acb.tar.bz2 mpv-689a25003fc8098e5fdfbb2faefc0e18365d3acb.tar.xz |
sub: support straight alpha additionally to premultiplied alpha
This is for VAAPI support. VAAPI does not support premultiplied alpha
for OSD. (Normally, we prefer premultiplied, because it has better
behavior on scaling.)
I'm not sure whether blending in the ASS->RGBA part is correct and I
didn't test it extensively.
Diffstat (limited to 'sub/sub.c')
-rw-r--r-- | sub/sub.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -202,13 +202,23 @@ static void render_object(struct osd_state *osd, struct osd_object *obj, if (formats[SUBBITMAP_RGBA] && out_imgs->format == SUBBITMAP_INDEXED) cached |= osd_conv_idx_to_rgba(obj->cache[1], out_imgs); - if (out_imgs->format == SUBBITMAP_RGBA && opts->sub_gauss != 0.0f) + if (formats[SUBBITMAP_RGBA_STR] && out_imgs->format == SUBBITMAP_INDEXED) + cached |= osd_conv_idx_to_rgba_str(obj->cache[1], out_imgs); + + if ((out_imgs->format == SUBBITMAP_RGBA || + out_imgs->format == SUBBITMAP_RGBA_STR) + && opts->sub_gauss != 0.0f) + { cached |= osd_conv_blur_rgba(obj->cache[2], out_imgs, opts->sub_gauss); + } // Do this conversion last to not trigger gauss blurring for ASS if (formats[SUBBITMAP_RGBA] && out_imgs->format == SUBBITMAP_LIBASS) cached |= osd_conv_ass_to_rgba(obj->cache[3], out_imgs); + if (formats[SUBBITMAP_RGBA_STR] && out_imgs->format == SUBBITMAP_LIBASS) + cached |= osd_conv_ass_to_rgba_str(obj->cache[3], out_imgs); + if (cached) obj->cached = *out_imgs; } |