diff options
Diffstat (limited to 'video/out/vo_sdl.c')
-rw-r--r-- | video/out/vo_sdl.c | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c index 8bde820b38..c2cc711d2f 100644 --- a/video/out/vo_sdl.c +++ b/video/out/vo_sdl.c @@ -177,8 +177,7 @@ struct priv { struct mp_osd_res osd_res; struct formatmap_entry osd_format; struct osd_bitmap_surface { - int bitmap_id; - int bitmap_pos_id; + int change_id; struct osd_target { SDL_Rect source; SDL_Rect dest; @@ -702,7 +701,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs) if (imgs->format == SUBBITMAP_EMPTY || imgs->num_parts == 0) return; - if (imgs->bitmap_pos_id == sfc->bitmap_pos_id) + if (imgs->change_id == sfc->change_id) return; if (imgs->num_parts > sfc->targets_size) { @@ -725,49 +724,46 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs) bmp->x, bmp->y, bmp->dw, bmp->dh }; - if (imgs->bitmap_id != sfc->bitmap_id || !target->tex) { - // tex: alpha blended texture - if (target->tex) { - SDL_DestroyTexture(target->tex); - target->tex = NULL; - } - if (!target->tex) - target->tex = SDL_CreateTexture(vc->renderer, - vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING, - bmp->w, bmp->h); - if (!target->tex) { - MP_ERR(vo, "Could not create texture\n"); - } - if (target->tex) { - SDL_SetTextureBlendMode(target->tex, - SDL_BLENDMODE_BLEND); - SDL_SetTextureColorMod(target->tex, 0, 0, 0); - subbitmap_to_texture(vo, target->tex, bmp, 0); // RGBA -> 000A - } + // tex: alpha blended texture + if (target->tex) { + SDL_DestroyTexture(target->tex); + target->tex = NULL; + } + if (!target->tex) + target->tex = SDL_CreateTexture(vc->renderer, + vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING, + bmp->w, bmp->h); + if (!target->tex) { + MP_ERR(vo, "Could not create texture\n"); + } + if (target->tex) { + SDL_SetTextureBlendMode(target->tex, + SDL_BLENDMODE_BLEND); + SDL_SetTextureColorMod(target->tex, 0, 0, 0); + subbitmap_to_texture(vo, target->tex, bmp, 0); // RGBA -> 000A + } - // tex2: added texture - if (target->tex2) { - SDL_DestroyTexture(target->tex2); - target->tex2 = NULL; - } - if (!target->tex2) - target->tex2 = SDL_CreateTexture(vc->renderer, - vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING, - bmp->w, bmp->h); - if (!target->tex2) { - MP_ERR(vo, "Could not create texture\n"); - } - if (target->tex2) { - SDL_SetTextureBlendMode(target->tex2, - SDL_BLENDMODE_ADD); - subbitmap_to_texture(vo, target->tex2, bmp, - 0xFF000000); // RGBA -> RGB1 - } + // tex2: added texture + if (target->tex2) { + SDL_DestroyTexture(target->tex2); + target->tex2 = NULL; + } + if (!target->tex2) + target->tex2 = SDL_CreateTexture(vc->renderer, + vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING, + bmp->w, bmp->h); + if (!target->tex2) { + MP_ERR(vo, "Could not create texture\n"); + } + if (target->tex2) { + SDL_SetTextureBlendMode(target->tex2, + SDL_BLENDMODE_ADD); + subbitmap_to_texture(vo, target->tex2, bmp, + 0xFF000000); // RGBA -> RGB1 } } - sfc->bitmap_id = imgs->bitmap_id; - sfc->bitmap_pos_id = imgs->bitmap_pos_id; + sfc->change_id = imgs->change_id; } static void draw_osd_part(struct vo *vo, int index) |