diff options
Diffstat (limited to 'video/out/gl_osd.c')
-rw-r--r-- | video/out/gl_osd.c | 54 |
1 files changed, 3 insertions, 51 deletions
diff --git a/video/out/gl_osd.c b/video/out/gl_osd.c index 2458a61cce..67944186a1 100644 --- a/video/out/gl_osd.c +++ b/video/out/gl_osd.c @@ -208,8 +208,8 @@ static bool upload_osd(struct mpgl_osd *ctx, struct mpgl_osd_part *osd, return true; } -static struct mpgl_osd_part *osd_generate(struct mpgl_osd *ctx, - struct sub_bitmaps *imgs) +struct mpgl_osd_part *mpgl_osd_generate(struct mpgl_osd *ctx, + struct sub_bitmaps *imgs) { if (imgs->num_parts == 0 || !ctx->formats[imgs->format]) return NULL; @@ -253,54 +253,6 @@ void mpgl_osd_unset_gl_state(struct mpgl_osd *ctx, struct mpgl_osd_part *p) gl->BindTexture(GL_TEXTURE_2D, 0); } -static void reset(struct mpgl_osd *ctx) -{ - for (int n = 0; n < MAX_OSD_PARTS; n++) { - struct mpgl_osd_part *p = ctx->parts[n]; - p->active = false; - } -} - -struct draw_cb_closure { - struct mpgl_osd *ctx; - void (*cb)(void *ctx, struct mpgl_osd_part *part, struct sub_bitmaps *imgs); - void *cb_ctx; -}; - -static void draw_cb(void *pctx, struct sub_bitmaps *imgs) -{ - struct draw_cb_closure *c = pctx; - struct mpgl_osd_part *part = osd_generate(c->ctx, imgs); - if (!part) - return; - part->active = true; - c->cb(c->cb_ctx, part, imgs); -} - -void mpgl_osd_draw_cb(struct mpgl_osd *ctx, - double pts, - struct mp_osd_res res, - void (*cb)(void *ctx, struct mpgl_osd_part *part, - struct sub_bitmaps *imgs), - void *cb_ctx) -{ - struct draw_cb_closure c = {ctx, cb, cb_ctx}; - reset(ctx); - osd_draw(ctx->osd, res, pts, 0, ctx->formats, draw_cb, &c); -} - -void mpgl_osd_redraw_cb(struct mpgl_osd *ctx, - void (*cb)(void *ctx, struct mpgl_osd_part *part, - struct sub_bitmaps *imgs), - void *cb_ctx) -{ - for (int n = 0; n < MAX_OSD_PARTS; n++) { - struct mpgl_osd_part *p = ctx->parts[n]; - if (p->active) - cb(cb_ctx, p, NULL); - } -} - struct vertex { float position[2]; uint8_t color[4]; @@ -310,7 +262,7 @@ struct vertex { static void draw_legacy_cb(void *pctx, struct sub_bitmaps *imgs) { struct mpgl_osd *ctx = pctx; - struct mpgl_osd_part *osd = osd_generate(ctx, imgs); + struct mpgl_osd_part *osd = mpgl_osd_generate(ctx, imgs); if (!osd) return; |