diff options
author | wm4 <wm4@nowhere> | 2014-10-01 23:58:14 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-02 00:06:08 +0200 |
commit | 2064fc29907e4d58b5380c7dc6a2721a6c5f2268 (patch) | |
tree | a704a1f5b4b500416ab91b770329f5a06ea67f4e | |
parent | 64fb37c173e0ecee0e62d78b96c03d609845e8a4 (diff) | |
download | mpv-2064fc29907e4d58b5380c7dc6a2721a6c5f2268.tar.bz2 mpv-2064fc29907e4d58b5380c7dc6a2721a6c5f2268.tar.xz |
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.
-rw-r--r-- | sub/osd.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; } |