Course rotation goes the wrong way when the image is already flipped, Issue 2239. On behalf of smartyrawtherapee
This commit is contained in:
@@ -109,7 +109,11 @@ void CoarsePanel::initBatchBehavior () {
|
||||
|
||||
void CoarsePanel::rotateLeft () {
|
||||
|
||||
degree = (degree + 270) % 360;
|
||||
//Rotate one way or the opposite depending if the image is already flipped or not
|
||||
if ( (vflip->get_active()) == (hflip->get_active ()) )
|
||||
degree = (degree + 270) % 360;
|
||||
else
|
||||
degree = (degree + 90) % 360;
|
||||
degreechanged = true;
|
||||
if (listener)
|
||||
listener->panelChanged (EvCTRotate, Glib::ustring::format (degree));
|
||||
@@ -117,7 +121,11 @@ void CoarsePanel::rotateLeft () {
|
||||
|
||||
void CoarsePanel::rotateRight () {
|
||||
|
||||
degree = (degree + 90) % 360;
|
||||
//Rotate one way or the opposite depending if the image is already flipped or not
|
||||
if ( (vflip->get_active()) == (hflip->get_active ()) )
|
||||
degree = (degree + 90) % 360;
|
||||
else
|
||||
degree = (degree + 270) % 360;
|
||||
degreechanged = true;
|
||||
if (listener)
|
||||
listener->panelChanged (EvCTRotate, Glib::ustring::format (degree));
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ class Crop : public Gtk::VBox, public CropGUIListener, public FoldableToolPanel,
|
||||
void resizeScaleChanged (double rsc);
|
||||
void hFlipCrop ();
|
||||
void vFlipCrop ();
|
||||
void rotateCrop (int deg);
|
||||
void rotateCrop (int deg, bool hflip, bool vflip);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -254,7 +254,7 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
|
||||
crop->write (params);
|
||||
}
|
||||
else if (event==rtengine::EvCTRotate) {
|
||||
crop->rotateCrop (params->coarse.rotate);
|
||||
crop->rotateCrop (params->coarse.rotate, params->coarse.hflip, params->coarse.vflip);
|
||||
crop->write (params);
|
||||
resize->update (params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
|
||||
resize->write (params);
|
||||
|
Reference in New Issue
Block a user