Hi, I have coded optimised Display.CopyBlock(), now putting it to a real test with `DIY Dialogs' I need to revisit my coding, that actually borrows from the original. PROCEDURE CopyBlock*(sx, sy, w, h, dx, dy, mode: INTEGER); (*only for mode = replace*) d := da - sa; n := u1 - v1; (*displacement in words and bits*) (*len := (u2 - u0) * 4;*) len := (v2 - v0) * 4; (*source/target word span in bytes*) ... IF dx = sx THEN (*scroll up / down*) (*use of SYSTEM.COPY()*) ELSIF (dy = sy) & (n <= 0) THEN (*scroll right*) (*use of ASR,LSL*) ELSIF (dy = sy) & (n > 0) THEN (*scroll left*) (*use of ASR,LSL*) ELSIF n <= 0 THEN (*shift diagonal right*) (*use of ROR*) ELSE (*n > 0 shift diagonal left*) (*use of ROR*) END ... I am not happy with my coding for horizontal scroll, has problems in some test cases. As a temporary solution for (dy = sy) case I wish to [1] scroll up /or down by 1 pixel (*optimised*) [2] do a diagonal move (*functional*) I could possibly introduce CopyBlock0(), and call from CopyBlock(), but I would prefer call CopyBlock() from within itself, but cannot figure out how, so the recursion is properly terminated. Many thanks. -- Tomas Kral <thomas.kral@email.cz>
Tomas As hint: My structure looks like this: ... d := da - sa; n := u1 - v1; IF d >= 0 THEN sa0 := sa + (h-1)* LINELEN; end := sa - LINELEN; step := -LINELEN (* copy up, scan down *) ELSE sa0 := sa; end := sa + h* LINELEN; step := LINELEN (* copy down, scan up *) END; WHILE sa0 # end DO IF n >= 0 THEN (* shift right *) IF v1 + w*BPP < 32 THEN (* in same word *) ... ELSE (* general case *) ... END ELSE (* shift left *) IF v1 + w*BPP < 32 THEN (* in same word *) ... ELSE (* general case *) ... END END; INC(sa0, step) END
Am 22.02.2019 um 15:15 schrieb Tomas Kral <thomas.kral@email.cz>:
Hi,
I have coded optimised Display.CopyBlock(), now putting it to a real test with `DIY Dialogs' I need to revisit my coding, that actually borrows from the original.
PROCEDURE CopyBlock*(sx, sy, w, h, dx, dy, mode: INTEGER); (*only for mode = replace*) d := da - sa; n := u1 - v1; (*displacement in words and bits*) (*len := (u2 - u0) * 4;*) len := (v2 - v0) * 4; (*source/target word span in bytes*) ... IF dx = sx THEN (*scroll up / down*) (*use of SYSTEM.COPY()*) ELSIF (dy = sy) & (n <= 0) THEN (*scroll right*) (*use of ASR,LSL*) ELSIF (dy = sy) & (n > 0) THEN (*scroll left*) (*use of ASR,LSL*) ELSIF n <= 0 THEN (*shift diagonal right*) (*use of ROR*) ELSE (*n > 0 shift diagonal left*) (*use of ROR*) END ...
I am not happy with my coding for horizontal scroll, has problems in some test cases. As a temporary solution for (dy = sy) case I wish to [1] scroll up /or down by 1 pixel (*optimised*) [2] do a diagonal move (*functional*)
I could possibly introduce CopyBlock0(), and call from CopyBlock(), but I would prefer call CopyBlock() from within itself, but cannot figure out how, so the recursion is properly terminated.
Many thanks.
-- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Fri, 22 Feb 2019 16:11:43 +0100 Jörg <joerg.straube@iaeth.ch> wrote:
As hint: My structure looks like this:
Joerg, thank you, will revisit my horizontal code, soon. Meanwhile, I stubbed out (dy = sy) case, so I now have... PROCEDURE CopyBlock*(sx, sy, w, h, dx, dy, mode: INTEGER); BEGIN IF dy = sy THEN INC(dy) END ; (*not implemented*) ... IF dx = sx THEN (*vertical scroll*) (*use of SYSTEM.COPY()*) ELSIF dy = sy THEN (*not implemented*) ELSIF n <= 0 THEN (*shift diagonal right*) (*use of ROR*) ELSE (*n > 0 shift diagonal left*) (*use of ROR*) END ; ... END CopyBlock; I know ugly, but will make do until resolved. Horizontal move does not seem as frequent as vertical one anyway, right? -- Tomas Kral <thomas.kral@email.cz>
participants (2)
-
Jörg -
Tomas Kral