Skip to content

Commit

Permalink
FIX: FOREACH works bad on image!
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Feb 16, 2020
1 parent d6626a8 commit 9f65341
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/n-loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
SET_INTEGER(vars, (REBI64)(BIN_HEAD(series)[index]));
}
else if (IS_IMAGE(value)) {
Set_Tuple_Pixel(BIN_SKIP(series, index), vars);
Set_Tuple_Pixel(BIN_SKIP(series, index<<2), vars);
}
else {
VAL_SET(vars, REB_CHAR);
Expand Down
12 changes: 12 additions & 0 deletions src/tests/units/image-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ Rebol [
--assert image? to image! make gob! []
===end-group===

===start-group=== "FOREACH"
--test-- "issue-1479"
;@@ https://github.com/Oldes/Rebol-issues/issues/1479
pix: copy []
img: make image! [1x2 #{010203040506} #{0102}]
foreach p img[ append pix p ]
--assert img/1 = pix/1
--assert img/2 = pix/2
--assert img/1 = 1.2.3.1
--assert img/2 = 4.5.6.2
===end-group===

===start-group=== "image range"
img: make image! 2x2
--test-- "image range (integer index)"
Expand Down

0 comments on commit 9f65341

Please sign in to comment.