This commit is contained in:
twinaphex 2017-11-13 09:19:33 +01:00
parent 6493b79324
commit da15f9d730

View File

@ -748,35 +748,27 @@ static void gl_render_osd_background(
gl_t *gl, video_frame_info_t *video_info,
const char *msg)
{
int msg_width;
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords_data;
video_coords_t coords;
video_shader_ctx_info_t shader_info;
struct uniform_info uniform_param;
float colors[4];
float x, x2, y, y2, width, height;
const unsigned
vertices_total = 6;
float *dummy = (float*)calloc(4 * vertices_total, sizeof(float));
float *verts = (float*)malloc(2 * vertices_total * sizeof(float));
settings_t *settings = config_get_ptr();
if (!gl || !settings)
goto end;
msg_width =
int msg_width =
font_driver_get_message_width(NULL, msg, strlen(msg), 1.0f);
/* shader driver expects vertex coords as 0..1 */
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
width = msg_width / (float)video_info->width;
height =
float x = video_info->font_msg_pos_x;
float y = video_info->font_msg_pos_y;
float width = msg_width / (float)video_info->width;
float height =
settings->floats.video_font_size / (float)video_info->height;
x2 = 0.005f; /* extend background around text */
y2 = 0.005f;
float x2 = 0.005f; /* extend background around text */
float y2 = 0.005f;
x -= x2;
y -= y2;
@ -817,24 +809,20 @@ static void gl_render_osd_background(
coords_data.handle_data = NULL;
coords_data.data = &coords;
shader_info.data = NULL;
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_driver_set_viewport(video_info->width,
video_info->height, true, false);
video_shader_driver_use(shader_info);
video_info->cb_shader_use(gl,
video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true);
video_shader_driver_set_coords(coords_data);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
mvp.data = gl;
mvp.matrix = &gl->mvp_no_rot;
video_shader_driver_set_mvp(mvp);
video_info->cb_shader_set_mvp(gl,
video_info->shader_data, &gl->mvp_no_rot);
uniform_param.type = UNIFORM_4F;
uniform_param.enabled = true;
@ -843,7 +831,7 @@ static void gl_render_osd_background(
uniform_param.lookup.type = SHADER_PROGRAM_FRAGMENT;
uniform_param.lookup.ident = "bgcolor";
uniform_param.lookup.idx = shader_info.idx;
uniform_param.lookup.idx = VIDEO_SHADER_STOCK_BLEND;
uniform_param.lookup.add_prefix = true;
uniform_param.lookup.enable = true;
@ -855,7 +843,7 @@ static void gl_render_osd_background(
video_shader_driver_set_parameter(uniform_param);
glDrawArrays(GL_TRIANGLES, 0, coords.vertices);
end:
/* reset uniform back to zero so it is not used for anything else */
uniform_param.result.f.v0 = 0.0f;
uniform_param.result.f.v1 = 0.0f;