Skip to content

Commit c8510f1

Browse files
committed
FIX: MOLD/FLAT on image does not removes line breaks in the alpha channel
Related to: metaeducation/rebol-issues#2389
1 parent 09e8c42 commit c8510f1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/core/t-image.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,11 @@ INLINE REBCNT ARGB_To_BGR(REBCNT i)
491491
if (indented) Append_Byte(mold->series, '\n');
492492
Append_Bytes(mold->series, "} #{");
493493

494-
up = Prep_Uni_Series(mold, (size * 2) + (size / 10) + 1);
494+
up = Prep_Uni_Series(mold, indented ? (size * 2) + (size / 10) + 1 : size * 2);
495495

496496
data = (REBCNT *)VAL_IMAGE_DATA(value);
497497
for (len = 0; len < size; len++) {
498-
if ((len % 10) == 0) *up++ = LF;
498+
if (indented && (len % 10) == 0) *up++ = LF;
499499
up = Form_Hex2_Uni(up, *data++ >> 24);
500500
}
501501
}

src/tests/units/mold-test.r3

+2-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ Rebol [
295295
;@@ https://github.com/rebol/rebol-issues/issues/2389
296296
--assert (mold/flat make image! 8x1) = {make image! [8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]}
297297
--assert (mold/flat make image! 8x2) = {make image! [8x2 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]}
298-
298+
--assert (mold/flat make image! [1x1 0.0.0.66]) = {make image! [1x1 #{000000} #{42}]}
299+
299300
--test-- "mold/flat/all image!"
300301
--assert (mold/all/flat make image! 8x1) = {#[image! 8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]}
301302
--assert (mold/all/flat next make image! 8x1) = {#[image! 8x1 #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF} 2]}

0 commit comments

Comments
 (0)