[comp.sys.apple] list manager speedup

nicholaA@moravian.EDU (09/08/89)

Subj:  List Manager scrolling speed cure     89-08-31 21:38:22 EDT
From:  JimMensch                             Msgs:  1 (89-08-31)

Recently in a conference someone asked about list manager scrolling speed and
how to make it faster for large lists. Below is source code to a custom draw
proc that is faster than the standard. It is faster because it tests to see if
the item being drawn is in the clip region before making any drawing calls. For
wide items this improves scrolling speed by about 100%. Any questions?

------------------------------------------------------------------
MyListDraw      Start

; This routine draws a member

top             equ 0
left            equ top+2
bottom          equ left+2
right           equ bottom+2
rgnBounds       equ 2

;

oldDPage        equ 1
theRTL          equ oldDPage+2
listHand        equ theRTL+3
memPtr          equ listHand+4
theRect         equ memPtr+4
                using globals

                phd
                tsc
                tcd

                pha
                pha
                _getClipHandle
                PullLong listHand

                ldy #2
                lda [listhand],y
                tax
                lda [listhand]
                sta listhand
                stx listhand+2

                lda [therect]                ; now test the top
                dec a                 ; adjust and give a little slack
                ldy #rgnbounds+bottom
                cmp [listhand],y             ; rgnRectBottom>=top?
                blt skip2
                brl NoDraw                   ; if not don't draw..
Skip2           ldy #bottom    ; now see if the bottom is higher than th
                inc a                        ; give a little slack...
                lda [therect],y
                ldy #rgnBounds+top
                cmp [listhand],y
                blt NoDraw
NoTest          NOP

                PushLong theRect
                _EraseRect             ; erase the old rectangle...

                ldy #left
                lda [theRect],y
                tax
                ldy #bottom
                lda [theRect],y
                dec a
                phx
                pha
                _MoveTo

                ldy #2
                lda [memptr],y
                pha
                lda [memptr]
                pha
                _DrawString

                ldy #4
                lda [memPtr],y
                and #$00C0             ; strip the 6 and 7 bits
                beq memDrawn ; if they are both 0 the member is drawn
                cmp #$0080             ; member selected?
                bne noSelect           ; member not selectable...
                PushLong theRect
                _InvertRect
                bra memDrawn

; if we get here the member is disabled...

noSelect        PushLong #DimMask
                _SetPenMask
                PushLong theRect
                 _EraseRect
                PushLong #NorMask
                _SetPenMask
memDrawn        NOP

; exit here
                pld
                sep #$20
                longa off
                pla
                ply

                plx
                plx
                plx
                plx
                plx
                plx
                phy
                pha
                rep #$20
                longa on
                rtl
DimMask         dc  i1'$55,$AA,$55,$AA,$55,$AA,$55,$AA'
NorMask         dc  i1'$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF'
         
---------------------------------------------------------------------
Just thought some people might be interested...

andy