Skip to content

Commit

Permalink
Merge pull request #1 from dgorobets/dgorobets-patch-1
Browse files Browse the repository at this point in the history
Center image if source image size is smaller than destination
  • Loading branch information
dgorobets authored Mar 14, 2018
2 parents a13a03e + 6ae897c commit 83a69d3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ngx_http_small_light_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@
void ngx_http_small_light_adjust_canvas_image_offset(ngx_http_small_light_image_size_t *sz)
{
if (sz->dx == NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE) {
sz->dx = (sz->cw - sz->dw) * 0.5;
if (sz->sw < sz->dw) {
sz->dx = (sz->cw - sz->sw) * 0.5;
} else {
sz->dx = (sz->cw - sz->dw) * 0.5;
}
}
if (sz->dy == NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE) {
sz->dy = (sz->ch - sz->dh) * 0.5;
if (sz->sh < sz->dh) {
sz->dy = (sz->ch - sz->sh) * 0.5;
} else {
sz->dy = (sz->ch - sz->dh) * 0.5;
}
}
}

Expand Down

0 comments on commit 83a69d3

Please sign in to comment.