zimg: fix previous odd sizes commit

Obviously, we don't want to lose fractions, and the zimg active_region
fields in fact have the type double. The integer division was wrong.

Also, always set active_region.width/height. It appears zimg behavior
does not change if they're set to the normal integer values, so the
extra check to not set them in this case was worthless.
This commit is contained in:
wm4 2020-02-13 00:12:49 +01:00
parent ffd89f5ff4
commit 7e6ea02183
1 changed files with 2 additions and 4 deletions

View File

@ -752,10 +752,8 @@ static bool setup_format(zimg_image_format *zfmt, struct mp_zimg_repack *r,
if (!r->pack && ctx) {
// Relies on ctx->zimg_dst being initialized first.
struct mp_zimg_repack *dst = ctx->zimg_dst;
if (r->real_w != fmt.w || dst->real_w != dst->fmt.w)
zfmt->active_region.width = dst->real_w * (uint64_t)fmt.w / dst->fmt.w;
if (r->real_h != fmt.h || dst->real_h != dst->fmt.h)
zfmt->active_region.height = dst->real_h * (uint64_t)fmt.h / dst->fmt.h;
zfmt->active_region.width = dst->real_w * (double)fmt.w / dst->fmt.w;
zfmt->active_region.height = dst->real_h * (double)fmt.h / dst->fmt.h;
}