diff options
author | 2012-10-05 20:37:16 +0200 | |
---|---|---|
committer | 2012-10-16 07:26:32 +0200 | |
commit | 44c62a685222f2b018a480246c2946d3e3e7529c (patch) | |
tree | 0c603432a889a4c6c549d8ee0f5cb5222586b7a0 /libvo | |
parent | 3ad918bbc62449759bbf97f6a809ebdde27ad59e (diff) |
sub: switch to premultiplied alpha
Fixes problems with ugly borders.
Note that at least in the DVD sub case, we could have just set all
transparent pixels to black to solve this.
vo_direct3d.c change untested, because mingw is a miserable pile of
crap.
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/gl_osd.c | 2 | ||||
-rw-r--r-- | libvo/vo_direct3d.c | 5 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 9 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libvo/gl_osd.c b/libvo/gl_osd.c index 74053afd4a..5266dca4ac 100644 --- a/libvo/gl_osd.c +++ b/libvo/gl_osd.c @@ -32,7 +32,7 @@ struct osd_fmt_entry { // glBlendFunc() arguments static const int blend_factors[SUBBITMAP_COUNT][2] = { [SUBBITMAP_LIBASS] = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, - [SUBBITMAP_RGBA] = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}, + [SUBBITMAP_RGBA] = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, }; static const struct osd_fmt_entry osd_to_gl3_formats[SUBBITMAP_COUNT] = { diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 4f16c6a6b1..2b8f3429e4 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -2049,6 +2049,9 @@ static void draw_osd(d3d_priv *priv, struct sub_bitmaps *imgs) IDirect3DDevice9_SetTextureStageState(priv->d3d_device, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); + } else { + IDirect3DDevice9_SetRenderState(priv->d3d_device, D3DRS_SRCBLEND, + D3DBLEND_ONE); } IDirect3DDevice9_SetFVF(priv->d3d_device, D3DFVF_EOSD_VERTEX); @@ -2060,6 +2063,8 @@ static void draw_osd(d3d_priv *priv, struct sub_bitmaps *imgs) D3DTSS_COLORARG1, D3DTA_TEXTURE); IDirect3DDevice9_SetTextureStageState(priv->d3d_device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); + IDirect3DDevice9_SetRenderState(priv->d3d_device, + D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); IDirect3DDevice9_SetTexture(priv->d3d_device, 0, NULL); diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 34aa9824dc..94d37e3018 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -970,14 +970,21 @@ static void draw_eosd(struct vo *vo, int index) .blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD, }; + VdpOutputSurfaceRenderBlendState blend_state_premultiplied = blend_state; + blend_state_premultiplied.blend_factor_source_color = + VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; + for (i = 0; i < sfc->render_count; i++) { + VdpOutputSurfaceRenderBlendState *blend = &blend_state; + if (sfc->format == VDP_RGBA_FORMAT_B8G8R8A8) + blend = &blend_state_premultiplied; vdp_st = vdp-> output_surface_render_bitmap_surface(output_surface, &sfc->targets[i].dest, sfc->surface, &sfc->targets[i].source, &sfc->targets[i].color, - &blend_state, + blend, VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); CHECK_ST_WARNING("EOSD: Error when rendering"); } |