summaryrefslogtreecommitdiffstats
path: root/video/out/vo_direct3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-18 12:33:14 +0100
committerwm4 <wm4@nowhere>2015-03-18 13:15:20 +0100
commit51befc9debef818cbf071aebf8861457ac095f8d (patch)
tree140152a3b5db9655c5b869d83a7d0c6212c91a6a /video/out/vo_direct3d.c
parent15478ca31c48d46b576264299803ab43fdeb1d04 (diff)
downloadmpv-51befc9debef818cbf071aebf8861457ac095f8d.tar.bz2
mpv-51befc9debef818cbf071aebf8861457ac095f8d.tar.xz
osd: simplify an aspect of change detection handling
There was a somewhat obscure optimization in the OSD and subtitle rendering path: if only the position of the sub-images changed, and not the actual image data, uploading of the image data could be skipped. In theory, this could speed up things like scrolling subtitles. But it turns out that even in the rare cases subtitles have such scrolls or axis-aligned movement, modern libass rarely signals this kind of change. Possibly this is because of sub-pixel handling and such, which break this. As such, it's a worthless optimization and just introduces additional complexity and subtle bugs (especially in cases libass does the opposite: incorrectly signaling a position change only, which happened before). Remove this optimization, and rename bitmap_pos_id to change_id.
Diffstat (limited to 'video/out/vo_direct3d.c')
-rw-r--r--video/out/vo_direct3d.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 1977d64a11..b6e40e75ec 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -103,7 +103,7 @@ struct texplane {
struct osdpart {
enum sub_bitmap_format format;
- int bitmap_id, bitmap_pos_id;
+ int change_id;
struct d3dtex texture;
int num_vertices;
vertex_osd *vertices;
@@ -453,7 +453,7 @@ static void destroy_d3d_surfaces(d3d_priv *priv)
for (int n = 0; n < MAX_OSD_PARTS; n++) {
struct osdpart *osd = priv->osd[n];
d3dtex_release(priv, &osd->texture);
- osd->bitmap_id = osd->bitmap_pos_id = -1;
+ osd->change_id = -1;
}
if (priv->d3d_backbuf)
@@ -1618,14 +1618,11 @@ static struct osdpart *generate_osd(d3d_priv *priv, struct sub_bitmaps *imgs)
struct osdpart *osd = priv->osd[imgs->render_index];
- if (imgs->bitmap_pos_id != osd->bitmap_pos_id) {
- if (imgs->bitmap_id != osd->bitmap_id) {
- if (!upload_osd(priv, osd, imgs))
- osd->packer->count = 0;
- }
+ if (imgs->change_id != osd->change_id) {
+ if (!upload_osd(priv, osd, imgs))
+ osd->packer->count = 0;
- osd->bitmap_id = imgs->bitmap_id;
- osd->bitmap_pos_id = imgs->bitmap_pos_id;
+ osd->change_id = imgs->change_id;
osd->num_vertices = 0;
}