From 127ae6eabdeeea24d25d23addac63a03a85dfb13 Mon Sep 17 00:00:00 2001 From: janrinze Date: Thu, 20 Jan 2011 00:34:36 +0100 Subject: [PATCH] fix bug for rotation of jpeg, tiff and other non-raw files --- rtengine/stdimagesource.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index e35154bdd..b662316a4 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -140,6 +140,8 @@ void StdImageSource::transform (PreviewProps pp, int tran, int &sx1, int &sy1, i sy2 = sy1 + pp.w; } printf ("ppx %d ppy %d ppw %d pph %d s: %d %d %d %d\n",pp.x, pp.y,pp.w,pp.h,sx1,sy1,sx2,sy2); + if (sx1<0)sx1=0; + if (sy1<0)sy1=0; } void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, bool first, HRecParams hrp) { @@ -156,12 +158,22 @@ void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Image16* image, Previ bm /= mul_lum; int sx1, sy1, sx2, sy2; + transform (pp, tran, sx1, sy1, sx2, sy2); + // printf(" sx1:%d sy1:%d sx2:%d sy2:%d\n",sx1, sy1, sx2, sy2); /* the sizes are already known: image->width and image->height int imwidth = (sx2 - sx1) / pp.skip + ((sx2 - sx1) % pp.skip > 0); int imheight = (sy2 - sy1) / pp.skip + ((sy2 - sy1) % pp.skip > 0); */ int imwidth=image->width,imheight=image->height; + // printf("1: imw=%d imh=%d\n",imwidth,imheight); + if (((tran & TR_ROT) == TR_R90)||((tran & TR_ROT) == TR_R270)) + { + int swap = imwidth; + imwidth=imheight; + imheight=swap; + } + // printf("2: imw=%d imh=%d\n",imwidth,imheight); int istart = sy1; int maxx=img->width,maxy=img->height; int mtran = tran;