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.
This commit is contained in:
wm4 2014-10-01 23:58:14 +02:00
parent 64fb37c173
commit 2064fc2990
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}