diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-21 19:02:21 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-21 19:02:21 +0000 |
commit | 8b89c882cef2c846789a22f65233c60030bf3491 (patch) | |
tree | 4e7e2c59961e062ef8a0ec630ef421c6f64c8feb /src | |
parent | e8fe3ce0981aec98fc74382515765b373f072e07 (diff) | |
download | nginx-8b89c882cef2c846789a22f65233c60030bf3491.tar.gz nginx-8b89c882cef2c846789a22f65233c60030bf3491.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_image_filter_module.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c index dd3c9cee5..c853c33d0 100644 --- 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; |