Fix slowdown in draw-browser/clear

Make the clear routine only clear lines up to the screen width.
This fixes slowdown on wasted clearing of off-screen tiles.

TODO: Only clear/draw lines that will be on the screen.
This commit is contained in:
DeltaF1 2021-11-28 23:58:15 -05:00 committed by neauoire
parent 1574e5dcce
commit a4bed43880
1 changed files with 10 additions and 1 deletions

View File

@ -5,8 +5,10 @@
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%8// { #03 SFT2 }
%10** { #40 SFT2 } %10// { #04 SFT2 } %10** { #40 SFT2 } %10// { #04 SFT2 }
%MIN2 { LTH2k JMP SWP2 POP2 }
%MOD { DIVk MUL SUB } %MOD { DIVk MUL SUB }
%DEC { #01 - } %DEC { #01 - }
%RTN { JMP2r } %RTN { JMP2r }
@ -61,6 +63,10 @@
#0100 .Audio0/length DEO2 #0100 .Audio0/length DEO2
#dd .Audio0/volume DEO ( TODO: turn ON ) #dd .Audio0/volume DEO ( TODO: turn ON )
( determine max visible file length )
.Screen/width DEI2 8// #00ff MIN2 NIP
;draw-browser/clear-length STA
( place ) ( place )
#0088 .browser/x STZ2 #0088 .browser/x STZ2
#0010 .browser/y STZ2 #0010 .browser/y STZ2
@ -290,7 +296,10 @@ RTN
&clear ( -- ) &clear ( -- )
.Screen/x DEI2k ( Stash the current x pos ) .Screen/x DEI2k ( Stash the current x pos )
#ff00
( Clear the screen )
( Clear length gets set in init )
LIT2 &clear-length 00 00
&clear-loop &clear-loop
#00 .Screen/sprite DEO #00 .Screen/sprite DEO
.Screen/y DEI2k #0008 ++ ROT DEO2 .Screen/y DEI2k #0008 ++ ROT DEO2