Skip to content

Commit 2c96f1d

Browse files
committed
Minor code clean-up.
1 parent 3ba2e4b commit 2c96f1d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/iop/crop.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,19 @@ static void _commit_box(dt_iop_module_t *self,
281281
exact ? "exact" : "as is",
282282
aspect, p->ratio_n, p->ratio_d, align_w, align_h, dw, dh, width, height, points[2] - points[0], points[3] - points[1]);
283283
}
284+
284285
// use possibly aspect corrected data and verify that the crop area stays in the image area
285286
p->cx = CLAMPF(points[0] / (float)piece->buf_out.width, 0.0f, 0.9f);
286287
p->cy = CLAMPF(points[1] / (float)piece->buf_out.height, 0.0f, 0.9f);
287288
p->cw = CLAMPF(points[2] / (float)piece->buf_out.width, 0.1f, 1.0f);
288289
p->ch = CLAMPF(points[3] / (float)piece->buf_out.height, 0.1f, 1.0f);
289290

290291
if(enforce_history
291-
|| !feqf(p->cx, old[0], eps)
292-
|| !feqf(p->cy, old[1], eps)
293-
|| !feqf(p->cw, old[2], eps)
294-
|| !feqf(p->ch, old[3], eps))
295-
dt_dev_add_history_item(darktable.develop, self, TRUE);
292+
|| !feqf(p->cx, old[0], eps)
293+
|| !feqf(p->cy, old[1], eps)
294+
|| !feqf(p->cw, old[2], eps)
295+
|| !feqf(p->ch, old[3], eps))
296+
dt_dev_add_history_item(darktable.develop, self, TRUE);
296297
}
297298
}
298299
}
@@ -905,11 +906,7 @@ static void _event_aspect_presets_changed(GtkWidget *combo, dt_iop_module_t *sel
905906
// now we save all that if it has changed
906907
if(d != abs(p->ratio_d) || n != p->ratio_n)
907908
{
908-
if(p->ratio_d >= 0)
909-
p->ratio_d = d;
910-
else
911-
p->ratio_d = -d;
912-
909+
p->ratio_d = abs(d);
913910
p->ratio_n = n;
914911
p->aligned = p->ratio_d != 0 && p->ratio_n != 0;
915912

0 commit comments

Comments
 (0)