Skip to content

Commit 082a316

Browse files
committed
FIX: returned position after INSERT action on IMAGE must be at tail not before.
related to: Oldes/Rebol-issues#783
1 parent ac36bf3 commit 082a316

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/t-image.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
rgba[C_R] = bin[0];
393393
rgba[C_G] = bin[1];
394394
rgba[C_B] = bin[2];
395-
rgba[C_A] = bin[3];
395+
rgba[C_A] = 255 - bin[3];
396396
}
397397
}
398398

@@ -669,7 +669,6 @@ INLINE REBCNT ARGB_To_BGR(REBCNT i)
669669

670670
if (action == A_APPEND) {
671671
index = tail;
672-
action = A_INSERT;
673672
}
674673

675674
x = index % w; // offset on the line
@@ -758,11 +757,13 @@ INLINE REBCNT ARGB_To_BGR(REBCNT i)
758757
}
759758

760759
// Expand image data if necessary:
761-
if (action == A_INSERT) {
760+
if (action == A_INSERT || action == A_APPEND) {
762761
if (index > tail) index = tail;
763762
Expand_Series(VAL_SERIES(value), index, dup * part);
764763
CLEAR_IMAGE(VAL_BIN(value) + (index * 4), dup, part);
765764
Reset_Height(value);
765+
if (action == A_INSERT)
766+
VAL_INDEX(value) = index + (dup * part); // so it is on position after insertion
766767
tail = VAL_TAIL(value);
767768
only = 0;
768769
}

0 commit comments

Comments
 (0)