diff --git a/src/core/t-image.c b/src/core/t-image.c index 4163508915..c00bc68f97 100644 --- a/src/core/t-image.c +++ b/src/core/t-image.c @@ -477,6 +477,10 @@ INLINE REBCNT ARGB_To_BGR(REBCNT i) Append_Byte(mold->series, '}'); return; } + + // use `flat` result for images with less than 10 pixels (looks better in console) + if (size < 10) indented = FALSE; + data = (REBCNT *)VAL_IMAGE_DATA(value); up = Prep_Uni_Series(mold, indented ? ((size * 6) + ((size - 1) / 10) + 1) : (size * 6)); diff --git a/src/tests/units/mold-test.r3 b/src/tests/units/mold-test.r3 index eb61e67c27..c61ca1338f 100644 --- a/src/tests/units/mold-test.r3 +++ b/src/tests/units/mold-test.r3 @@ -291,12 +291,16 @@ Rebol [ --assert "make image! [10x0 #{}]" = mold make image! 10x0 --assert "make image! [0x10 #{}]" = mold make image! 0x10 + --test-- "mold small image" + ;@@ https://github.com/Oldes/Rebol3/issues/13 + --assert (mold make image! 2x2) = {make image! [2x2 #{FFFFFFFFFFFFFFFFFFFFFFFF}]} + --test-- "mold/flat image!" ;@@ https://github.com/rebol/rebol-issues/issues/2389 --assert (mold/flat make image! 8x1) = {make image! [8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]} --assert (mold/flat make image! 8x2) = {make image! [8x2 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]} --assert (mold/flat make image! [1x1 0.0.0.66]) = {make image! [1x1 #{000000} #{42}]} - + --test-- "mold/flat/all image!" --assert (mold/all/flat make image! 8x1) = {#[image! 8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]} --assert (mold/all/flat next make image! 8x1) = {#[image! 8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF} 2]}