Skip to content

Commit

Permalink
Fix crop for square raw files
Browse files Browse the repository at this point in the history
When fixing the dimensions for the chosen aspect we have to assume a landscape or not.
This check failed so far, now we assume a square to be a landscape too at all code parts.
  • Loading branch information
jenshannoschwalm authored and TurboGit committed Aug 27, 2024
1 parent 5b8f683 commit 80f8355
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/iop/crop.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void modify_roi_out(struct dt_iop_module_t *self,
// if the aspect has been toggled it's presented here as negative
const float aspect = d->aspect < 0.0f ? fabsf(1.0f / d->aspect) : d->aspect;
const gboolean keep_aspect = aspect > 1e-5;
const gboolean landscape = roi_in->width > roi_in->height;
const gboolean landscape = roi_in->width >= roi_in->height;

float dx = odx;
float dy = ody;
Expand Down Expand Up @@ -533,7 +533,7 @@ static float _aspect_ratio_get(dt_iop_module_t *self, GtkWidget *combo)

if(!(wd > 0.0f && ht > 0.0f)) return 0.0f;

const gboolean regular = (p->ratio_d > 0 && wd > ht)
const gboolean regular = (p->ratio_d > 0 && wd >= ht)
|| (p->ratio_d < 0 && wd < ht);
return regular ? wd / ht : ht / wd;
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ static void _event_key_swap(dt_iop_module_t *self)

int iwd, iht;
dt_dev_get_processed_size(&darktable.develop->full, &iwd, &iht);
const gboolean horizontal = (iwd > iht) == (p->ratio_d < 0);
const gboolean horizontal = (iwd >= iht) == (p->ratio_d < 0);

_aspect_apply(self, horizontal ? GRAB_HORIZONTAL : GRAB_VERTICAL);
dt_control_queue_redraw_center();
Expand Down

0 comments on commit 80f8355

Please sign in to comment.