Course rotation goes the wrong way when the image is already flipped, Issue 2239. On behalf of smartyrawtherapee

This commit is contained in:
Ingo
2014-02-18 00:23:27 +01:00
parent 50eb43ede0
commit 79a90d6874
4 changed files with 39 additions and 29 deletions

View File

@@ -494,32 +494,34 @@ void Crop::vFlipCrop () {
g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false));
}
void Crop::rotateCrop (int deg) {
int tmp;
switch ((360+deg-lastRotationDeg)%360) {
case 90:
tmp = nx;
nx = maxh - ny - nh;
ny = tmp;
tmp = nw;
nw = nh;
nh = tmp;
break;
case 270:
tmp = ny;
ny = maxw - nx - nw;
nx = tmp;
tmp = nw;
nw = nh;
nh = tmp;
break;
case 180:
nx = maxw - nx - nw;
ny = maxh - ny - nh;
break;
}
void Crop::rotateCrop (int deg, bool hflip, bool vflip) {
int rotation = (360+deg-lastRotationDeg)%360;
if((hflip != vflip) && ((rotation%180)==90))
rotation = (rotation + 180)%360;
int tmp;
switch (rotation) {
case 90:
tmp = nx;
nx = maxh - ny - nh;
ny = tmp;
tmp = nw;
nw = nh;
nh = tmp;
break;
case 270:
tmp = ny;
ny = maxw - nx - nw;
nx = tmp;
tmp = nw;
nw = nh;
nh = tmp;
break;
case 180:
nx = maxw - nx - nw;
ny = maxh - ny - nh;
break;
}
lastRotationDeg = deg;
g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false));
}