[Oberon] PO2013 - CopyBlock
Tomas Kral
thomas.kral at email.cz
Wed Jul 8 15:33:49 CEST 2020
Hi,
As I have optimised vertical scroll w/ SYSTEM.COPY,
I do horizontal scroll recursive.
IF sx = sy THEN (*horizontal scroll*)
CopyBlock(sx, sy, w, h, dx, dy-1, mode);
CopyBlock(dx, dy-1, w, h, dx, dy, mode)
ELSE
IF dx = sx THEN (*vertical scroll w/ SYSTEM.COPY*)
ELSIF n <= 0 THEN (*diagonal right*)
ELSE (*diagonal left*)
END
END
I have two versions of diagonal shift,
[a] using ASR LSL, shorter slower code
[b] using ROR, faster bigger code
Running a little benchmark on moving an arbitrary block of 400x300 pixels (4bit colour) horizontally and diagonally.
[a]
diagonal left 59 ms
diagonal right 58 ms
horizontal left 50 ms
horizontal right 50 ms
[b]
diagonal left 51 ms
diagonal right 48 ms
horizontal left 42 ms
horizontal right 40 ms
The recursion has only 8 ms overhead, some 8 ms is also the delta between faster [b] and [a] variant.
--
Tomas Kral <thomas.kral at email.cz>
More information about the Oberon
mailing list