~ubuntu-branches/ubuntu/oneiric/nginx/oneiric

« back to all changes in this revision

Viewing changes to src/http/modules/ngx_http_image_filter_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2011-06-01 19:12:25 UTC
  • mfrom: (4.2.33 sid)
  • Revision ID: james.westby@ubuntu.com-20110601191225-8gzfabmbwlwj758m
Tags: 1.0.4-1
* New upstream release
* debian/*.lintian-overrides, debian/rules:
  + Removed unused lintian for missing manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
723
723
static ngx_buf_t *
724
724
ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
725
725
{
726
 
    int                            sx, sy, dx, dy, ox, oy, size,
 
726
    int                            sx, sy, dx, dy, ox, oy, ax, ay, size,
727
727
                                   colors, palette, transparent,
728
728
                                   red, green, blue, t;
729
729
    u_char                        *out;
852
852
    if (ctx->angle) {
853
853
        src = dst;
854
854
 
 
855
        ax = (dx % 2 == 0) ? 1 : 0;
 
856
        ay = (dy % 2 == 0) ? 1 : 0;
 
857
 
855
858
        switch (ctx->angle) {
856
859
 
857
860
        case 90:
861
864
                gdImageDestroy(src);
862
865
                return NULL;
863
866
            }
864
 
            gdImageCopyRotated(dst, src, dy/2, dx/2, 0, 0, dx, dy, ctx->angle);
 
867
            if (ctx->angle == 90) {
 
868
                ox = dy / 2 + ay;
 
869
                oy = dx / 2 - ax;
 
870
 
 
871
            } else {
 
872
                ox = dy / 2 - ay;
 
873
                oy = dx / 2 + ax;
 
874
            }
 
875
 
 
876
            gdImageCopyRotated(dst, src, ox, oy, 0, 0,
 
877
                               dx + ax, dy + ay, ctx->angle);
865
878
            gdImageDestroy(src);
866
879
 
867
880
            t = dx;
875
888
                gdImageDestroy(src);
876
889
                return NULL;
877
890
            }
878
 
            gdImageCopyRotated(dst, src, dx/2, dy/2, 0, 0, dx, dy, ctx->angle);
 
891
            gdImageCopyRotated(dst, src, dx / 2 - ax, dy / 2 - ay, 0, 0,
 
892
                               dx + ax, dy + ay, ctx->angle);
879
893
            gdImageDestroy(src);
880
894
            break;
881
895
        }