Skip to content

Commit 8956c16

Browse files
Merge pull request #18847 from jenshannoschwalm/dead_crop_code
Remove dead code in crop module
2 parents 8df4253 + d8bb222 commit 8956c16

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

src/iop/crop.c

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -602,90 +602,6 @@ static float _aspect_ratio_get(dt_iop_module_t *self, GtkWidget *combo)
602602

603603
const int iwd = piece->buf_in.width, iht = piece->buf_in.height;
604604

605-
// if we do not have yet computed the aspect ratio, let's do it now
606-
if(p->ratio_d == -2 && p->ratio_n == -2)
607-
{
608-
if(p->cw == 1.0f && p->cx == 0.0f && p->ch == 1.0f && p->cy == 0.0f)
609-
{
610-
p->ratio_d = -1;
611-
p->ratio_n = -1;
612-
}
613-
else
614-
{
615-
const dt_interpolation_t *interpolation = dt_interpolation_new(DT_INTERPOLATION_USERPREF_WARP);
616-
const float whratio = ((float)(iwd - 2 * interpolation->width) * (p->cw - p->cx))
617-
/ ((float)(iht - 2 * interpolation->width) * (p->ch - p->cy));
618-
const float ri = (float)iwd / (float)iht;
619-
620-
const float prec = 0.0003f;
621-
if(fabsf(whratio - 3.0f / 2.0f) < prec)
622-
{
623-
p->ratio_d = 3;
624-
p->ratio_n = 2;
625-
}
626-
else if(fabsf(whratio - 2.0f / 1.0f) < prec)
627-
{
628-
p->ratio_d = 2;
629-
p->ratio_n = 1;
630-
}
631-
else if(fabsf(whratio - 7.0f / 5.0f) < prec)
632-
{
633-
p->ratio_d = 7;
634-
p->ratio_n = 5;
635-
}
636-
else if(fabsf(whratio - 4.0f / 3.0f) < prec)
637-
{
638-
p->ratio_d = 4;
639-
p->ratio_n = 3;
640-
}
641-
else if(fabsf(whratio - 5.0f / 4.0f) < prec)
642-
{
643-
p->ratio_d = 5;
644-
p->ratio_n = 4;
645-
}
646-
else if(fabsf(whratio - 1.0f / 1.0f) < prec)
647-
{
648-
p->ratio_d = 1;
649-
p->ratio_n = 1;
650-
}
651-
else if(fabsf(whratio - 16.0f / 9.0f) < prec)
652-
{
653-
p->ratio_d = 16;
654-
p->ratio_n = 9;
655-
}
656-
else if(fabsf(whratio - 16.0f / 10.0f) < prec)
657-
{
658-
p->ratio_d = 16;
659-
p->ratio_n = 10;
660-
}
661-
else if(fabsf(whratio - 244.5f / 203.2f) < prec)
662-
{
663-
p->ratio_d = 2445;
664-
p->ratio_n = 2032;
665-
}
666-
else if(fabsf(whratio - sqrtf(2.0f)) < prec)
667-
{
668-
p->ratio_d = 14142136;
669-
p->ratio_n = 10000000;
670-
}
671-
else if(fabsf(whratio - PHI) < prec)
672-
{
673-
p->ratio_d = 16180340;
674-
p->ratio_n = 10000000;
675-
}
676-
else if(fabsf(whratio - ri) < prec)
677-
{
678-
p->ratio_d = 1;
679-
p->ratio_n = 0;
680-
}
681-
else
682-
{
683-
p->ratio_d = 0;
684-
p->ratio_n = 0;
685-
}
686-
}
687-
}
688-
689605
if(p->ratio_d == 0 && p->ratio_n == 0) return -1.0f;
690606
float d = 1.0f, n = 1.0f;
691607
if(p->ratio_n == 0)
@@ -1074,12 +990,6 @@ void gui_update(dt_iop_module_t *self)
1074990
dt_iop_crop_gui_data_t *g = self->gui_data;
1075991
dt_iop_crop_params_t *p = self->params;
1076992

1077-
// set aspect ratio based on the current image, if not found let's default
1078-
// to free aspect.
1079-
1080-
if(p->ratio_d == -2 && p->ratio_n == -2)
1081-
_aspect_ratio_get(self, g->aspect_presets);
1082-
1083993
if(p->ratio_d == -1 && p->ratio_n == -1)
1084994
{
1085995
p->ratio_d = dt_conf_get_int("plugins/darkroom/crop/ratio_d");

0 commit comments

Comments
 (0)