[OpenBIOS] [PATCH 14/16] display.fs: optimise scrolling by copying/deleting multiple scanlines at once.
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sun Mar 10 17:50:44 CET 2013
Change fb8-copy-line and fb8-clear-line so that they can operate on multiple
lines at once, renaming to fb8-copy-lines and fb8-clear-lines respectively.
Integrate these new functions into fb8-delete-lines so that they are used
when scrolling the display.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
openbios-devel/forth/device/display.fs | 41 +++++++++++++++-----------------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs
index 75aa632..a0a182c 100644
--- a/openbios-devel/forth/device/display.fs
+++ b/openbios-devel/forth/device/display.fs
@@ -174,17 +174,20 @@ defer fb8-invertrect
window-left +
;
-: fb8-copy-line ( from to -- )
- fb8-line2addr swap
- fb8-line2addr swap
- #columns char-width * depth-bytes * move
+: fb8-copy-lines ( count from to -- )
+ fb8-line2addr swap
+ fb8-line2addr swap
+ #columns char-width * depth-bytes *
+ 3 pick * move drop
;
-: fb8-clear-line ( line -- )
- fb8-line2addr
- #columns char-width * depth-bytes *
- background-color fill
-\ 0 fill
+: fb8-clear-lines ( count line -- )
+ background-color 0
+ 2 pick window-top +
+ #columns char-width *
+ 5 pick
+ fb8-fillrect
+ 2drop
;
: fb8-draw-character ( char -- )
@@ -268,20 +271,14 @@ defer fb8-invertrect
: fb8-delete-lines ( n -- )
\ numcopy = ( #lines - ( line# + n )) * char-height
#lines over line# + - char-height *
-
- ( numcopy ) 0 ?do
- dup line# + char-height * i +
- line# char-height * i +
- fb8-copy-line
- loop
-
- #lines over - char-height *
- over char-height *
- 0 ?do
- dup i + fb8-clear-line
- loop
+ over line# + char-height *
+ line# char-height *
+ fb8-copy-lines
- 2drop
+ #lines over - char-height *
+ dup #lines char-height * swap - swap
+ fb8-clear-lines
+ drop
;
--
1.7.10.4
More information about the OpenBIOS
mailing list