From 2064fc29907e4d58b5380c7dc6a2721a6c5f2268 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 1 Oct 2014 23:58:14 +0200 Subject: sub: round scaled subtitles Simple fix for issue #1137. Since all sub-bitmaps are packed on a larger texture, there's still a "fall off" on the border due to the linear scaling. This could be fixed by constraining each sub-bitmap to its own texture, or by clamping on the shader level, but I don't care for now. --- sub/osd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sub') diff --git a/sub/osd.c b/sub/osd.c index 85d951b3b7..f977bea078 100644 --- a/sub/osd.c +++ b/sub/osd.c @@ -485,10 +485,10 @@ void osd_rescale_bitmaps(struct sub_bitmaps *imgs, int frame_w, int frame_h, int cy = vidh / 2 - (int)(frame_h * yscale) / 2; for (int i = 0; i < imgs->num_parts; i++) { struct sub_bitmap *bi = &imgs->parts[i]; - bi->x = bi->x * xscale + cx + res.ml; - bi->y = bi->y * yscale + cy + res.mt; - bi->dw = bi->w * xscale; - bi->dh = bi->h * yscale; + bi->x = (int)(bi->x * xscale) + cx + res.ml; + bi->y = (int)(bi->y * yscale) + cy + res.mt; + bi->dw = (int)(bi->w * xscale + 0.5); + bi->dh = (int)(bi->h * yscale + 0.5); } imgs->scaled = xscale != 1 || yscale != 1; } -- cgit v1.2.3