Mercurial > hg > nginx-quic
changeset 4601:084137d883ec
Image filter: compare aspect ratio more accurately during crop.
Previously used fixed-point calculation caused wrong code path selection
in some cases, resulting in incorrect image size.
See here for report:
http://mailman.nginx.org/pipermail/nginx-devel/2012-April/002123.html
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 21 Apr 2012 19:02:21 +0000 |
parents | f1a7633b20a4 |
children | 8036fc6af2df |
files | src/http/modules/ngx_http_image_filter_module.c |
diffstat | 1 files changed, 1 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_image_filter_module.c +++ b/src/http/modules/ngx_http_image_filter_module.c @@ -817,9 +817,7 @@ transparent: resize = 0; - if ((ngx_uint_t) (dx * 100 / dy) - < ctx->max_width * 100 / ctx->max_height) - { + if ((double) dx / dy < (double) ctx->max_width / ctx->max_height) { if ((ngx_uint_t) dx > ctx->max_width) { dy = dy * ctx->max_width / dx; dy = dy ? dy : 1;