Skip to content

Commit 50d7ad0

Browse files
committed
fix display log on complex images
1 parent 07707f3 commit 50d7ad0

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

TODO

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
- complex images:
2-
3-
- display sliders don't work?
4-
- falsecolour doesn't work?
5-
6-
71
- get judder with rotate and images smaller than the window
82

93
draw on update, then draw again on relayout

src/displaybar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ displaybar_test_clicked(GtkButton *test, Displaybar *displaybar)
430430

431431
if (tilesource)
432432
g_object_set(tilesource,
433-
"mode", TILESOURCE_MODE_TOILET_ROLL,
433+
//"mode", TILESOURCE_MODE_TOILET_ROLL,
434+
"log", TRUE,
434435
NULL);
435436
}
436437

src/tilesource.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,18 @@ tilesource_log(VipsImage *image)
540540

541541
VipsImage *x;
542542

543-
if (vips_pow_const1(image, &t[0], power, NULL) ||
544-
vips_linear1(t[0], &t[1], 1.0, 1.0, NULL) ||
545-
vips_log10(t[1], &t[2], NULL) ||
543+
// force complex images to real
544+
if (vips_band_format_iscomplex(image->BandFmt)) {
545+
if (vips_abs(image, &t[0], NULL))
546+
return NULL;
547+
image = t[0];
548+
}
549+
550+
if (vips_pow_const1(image, &t[1], power, NULL) ||
551+
vips_linear1(t[1], &t[2], 1.0, 1.0, NULL) ||
552+
vips_log10(t[2], &t[3], NULL) ||
546553
// add 0.5 to get round to nearest
547-
vips_linear1(t[2], &x, scale, 0.5, NULL)) {
554+
vips_linear1(t[3], &x, scale, 0.5, NULL)) {
548555
return NULL;
549556
}
550557
image = x;

0 commit comments

Comments
 (0)