sys7.1-doc-wip/QuickDraw/DrawingVars.a

378 lines
15 KiB
Plaintext
Raw Normal View History

2019-07-27 14:37:48 +00:00
;
; File: DrawingVars.a
;
; Copyright: © 1988-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <13> 6/10/92 SAH Brought back in saveStkLowPt local so that Stretch can save and
; restore it properly, rather than munging it (along with most of
; your stack) in low memory situations.
; <12> 10/2/91 DTY Conditionalise last change for TheFuture.
; <11> 10/1/91 KON Save and restore stklowPt (rather than just setting it to sp on
; exit) in stretch. This fixes a bug where someone turns off the
; stack sniffer and then calls stretch which turns it back on.
; <10> 11/12/90 KON Move input rectangles to the very bottom of the stack frame so
; they don't move other stack locations needed by ROM routines as
; in ci class machines. [smc]
; <9> 11/9/90 KON Add newSrcRect, newMaskRect, and newDstRect to Stretchbits stack
; frame. [smc]
; <8> 10/31/90 SMC Add stack frame labels used in fixes of alpha channel bugs.
; <7> 8/26/90 KON Add stack frame variables for 32-bit clean pointers to color
; table used by stretch.
; <6> 8/2/90 gbm change TEMPRECT to TEMPRECTANGLE to avoid conflicts
; <5> 7/20/90 gbm Change some identifiers to cease conflicting with interface
; files
; <4> 5/22/90 KON Add flag to stretch for mode translation and colorizing. Used
; by stretch and passed to makeScaleTbl. Also added RGBFrColor
; and RGBBgColor to stretch stackframe for colorizing at srcbuf.
; <3> 5/1/90 KON Add srcMergeCase and MaskMergeCase variables for stretch.
; <1+> 1/3/90 BAL Added variables (in place) for Indexed to Indexed dithering support.
; <•1.4> 7/14/89 BAL For Aurora: Final CQD
; <1.3> 6/30/89 BAL Added some stack frame vars for future use
; <•1.2> 5/29/89 BAL Blasting in 32-Bit QuickDraw version 1.0 Final
; <•1.1> 4/12/89 BAL Blasting in 32-Bit QuickDraw 1.0B1
; 1/8/89 BAL Made destPixOffset a long for bfextu in bTransparent
; 11/5/88 BAL Added transfer direction (RUNBUMP) to SeekMask interface.
; 10/3/88 BAL Moved DstRow into the interface for SeekMask; (DstRow<0) ->
; seeking up. Reorganized variables to maintain long word
; alignment through out.
; 10/1/88 BAL Added RUNRTN, rtn to form n-bit run mask from 1-bit scan mask.
; 9/22/88 BAL Moved MINRECT, STACKFREE, and DSTSHIFT up into interface to
; SeekMask.
; 9/21/88 BAL Added RUNBUF, pointer to run encoded blit mask.
; 9/18/88 BAL Broken out from StretchBits, RgnBlt, BitBlt, SeekMask,
; PatExpand, DrawArc, DrawLine, DrawSlab, ColorMap.
;
; To Do:
;
;EASE$$$ READ ONLY COPY of file “drawingvars.a”
;•1.4 BAL 07/14/1989 For Aurora: Final CQD
; 1.3 BAL 06/30/1989 Added some stack frame vars for future use
;•1.2 BAL 05/29/1989 Blasting in 32-Bit QuickDraw version 1.0 Final
;•1.1 BAL 04/12/1989 Blasting in 32-Bit QuickDraw 1.0B1
; File Drawing Vars.a
;
; Copyright Apple Computer, Inc. 1988
; All Rights Reserved
;
;------------------------------------------------------------------
;
; MODIFICATIONS
;
; 18Sep88 BAL Broken out from StretchBits, RgnBlt, BitBlt, SeekMask, PatExpand,
; DrawArc, DrawLine, DrawSlab, ColorMap.
; 21Sep88 BAL Added RUNBUF, pointer to run encoded blit mask.
; 22Sep88 BAL Moved MINRECT, STACKFREE, and DSTSHIFT up into interface to SeekMask.
; 01Oct88 BAL Added RUNRTN, rtn to form n-bit run mask from 1-bit scan mask.
; 03Oct88 BAL Moved DstRow into the interface for SeekMask; (DstRow<0) -> seeking up.
; Reorganized variables to maintain long word alignment through out.
; 05Nov88 BAL Added transfer direction (RUNBUMP) to SeekMask interface.
; 08Jan89 BAL Made destPixOffset a long for bfextu in bTransparent
;----------------------------------------------------
;
; STACKFRAME LINKED AND LOCALS INITIALIZED BY STRETCHBITS.
;
; A6 OFFSETS OF LOCAL VARIABLES AFTER LINK:
;
; STACK FRAME VARS USED BY SEEKMASK (CALLED BY STRETCHBITS, RGNBLT, DRAWARC, DRAWLINE)
; (NOT USED IN PATEXPAND)
RECTFLAG EQU -2 ;WORD
VERT EQU RECTFLAG-2 ;WORD
RGNBUFFER EQU VERT-4 ;LONG
RUNBUF EQU RGNBUFFER-4 ;LONG <BAL 21Sep88>
BUFLEFT EQU RUNBUF-2 ;WORD
BUFSIZE EQU BUFLEFT-2 ;WORD
EXRTN EQU BUFSIZE-4 ;LONG
RUNRTN EQU EXRTN-4 ;LONG
SEEKMASK EQU RUNRTN-4 ;LONG
DSTMASKBUF EQU SEEKMASK-4 ;LONG
DSTMASKALIGN EQU DSTMASKBUF-4 ;LONG
STATEA EQU DSTMASKALIGN-RGNREC ;RGN STATE RECORD
STATEB EQU STATEA-RGNREC ;RGN STATE RECORD
STATEC EQU STATEB-RGNREC ;RGN STATE RECORD
MINRECT EQU STATEC-8 ;RECT <BAL 21Sep88>
DSTSHIFT EQU MINRECT-2 ;WORD <BAL 21Sep88>
RUNBUMP EQU DSTSHIFT-2 ;WORD <BAL 05Nov88>
DSTROW EQU RUNBUMP-4 ;LONG <BAL 03Oct88>
GoShow EQU DSTROW-4 ;LONG Go home and show crsr <BAL 21Mar89>
STACKFREE EQU GoShow-4 ;LONG <BAL 21Sep88>
IF (&CurFile ≠ 'SEEKMASK') THEN
; STACK FRAME VARS USED BY PATEXPAND, COLORMAP, DRAWSLAB
; (CALLED BY STRETCHBITS, RGNBLT, BITBLT, DRAWARC, DRAWLINE)
; SET UP FOR BITBLT FOR RGNBLT
EXPAT EQU STACKFREE-4 ;LONG YES
PATVMASK EQU EXPAT-2 ;WORD (must follow expat)
PATHMASK EQU PATVMASK-2 ;WORD (must follow PATVMASK)
PATROW EQU PATHMASK-2 ;WORD (must follow PATHMASK)
PATHPOS EQU PATROW-2 ;WORD YES
filler5 EQU PATHPOS-1 ;BYTE <8> YES
alphaMode EQU filler5-1 ;BYTE <8>
PATVPOS EQU alphaMode-4 ;LONG <8> YES <BAL 22Jan89>
LOCMODE EQU PATVPOS-2 ;WORD YES
LOCPAT EQU LOCMODE-4 ;LONG YES
FCOLOR EQU LOCPAT-4 ;LONG YES
BCOLOR EQU FCOLOR-4 ;LONG YES
useDither EQU BCOLOR-1 ;(was pixsrc) reclaimed 07Jul88 <BAL>
NEWPATTERN EQU useDither-1 ;BYTE YES
DSTPIX EQU NEWPATTERN-(PMREC+CTREC+20) ;PIXMAP+COLOR TABLE YES
alphaBack EQU DSTPIX-4 ;<8> NOTE THAT THESE
alphaMask EQU alphaBack-4 ;<8> OVERLAP WITH weight, pin
alphaFore EQU alphaMask-4 ;<8> AND notWeight BELOW
IF (&CurFile ≠ 'PATEXPAND') THEN
; these shared stack frame vars are set up and used by the arithmetic drawing modes
; (used by STRETCHBITS, RGNBLT, BITBLT, DRAWARC, DRAWLINE, DRAWSLAB, COLORMAP)
weight EQU DSTPIX-6 ;RGB weight for averaging
pin EQU weight ;RGB used by max, min
notWeight EQU weight-6 ;RGB complement of weight (for average)
multiColor EQU notWeight-1 ;byte set if source contains nonblack/white colors
MMUsave EQU multiColor-1 ;byte MMU mode on entry to QD
FGnotBlack EQU MMUsave-1 ;byte / true if forecolor ≠ black
BGnotWhite EQU FGnotBlack-1 ;byte \ true if backcolor ≠ white (must follow FGBlack)
colorTable EQU BGnotWhite-4 ;long pointer to color table
invColor EQU colorTable-4 ;long pointer to inverse color table
invSize EQU invColor-2 ;word resolution of inverse color table
rtShift EQU invSize-2 ;Word used by average how far to shift
transColor EQU rtShift-4 ;long copy of backcolor for transparent
hilitColor EQU transColor-4 ;long hilite color pixels
slabLeft EQU hilitColor-4 ;long bit offset from bufleft to pen position
patHBitPos EQU slabLeft-4 ;long bit offset to pattern left
IF (&CurFile = 'DRAWARC') THEN
; STACK FRAME VARS USED ONLY BY DRAWARC
SAVESTK EQU patHBitPos-4 ;LONG
MODECASE EQU SAVESTK-4 ;LONG
DSTLEFT EQU MODECASE-4 ;LONG
TEMPRECTANGLE EQU DSTLEFT-8 ;RECT
FASTFLAG EQU TEMPRECTANGLE-2 ;BYTE
INNEROVAL EQU FASTFLAG-OVALSIZE ;OVAL RECORD (46)
CRSRFLAG EQU INNEROVAL-2 ;WORD
OUTEROVAL EQU CRSRFLAG-OVALSIZE ;OVAL RECORD (46)
SKIPTOP EQU OUTEROVAL-2 ;WORD
SKIPBOT EQU SKIPTOP-2 ;WORD
ARCFLAG EQU SKIPBOT-1 ;BYTE FLAG
SKIPFLAG EQU ARCFLAG-1 ;BYTE FLAG
STOPANGLE EQU SKIPFLAG-2 ;INTEGER
MIDVERT EQU STOPANGLE-2 ;INTEGER
MIDHORIZ EQU MIDVERT-2 ;INTEGER
WIDTH EQU MIDHORIZ-2 ;INTEGER
HEIGHT EQU WIDTH-2 ;INTEGER
SLOPE1 EQU HEIGHT-4 ;LONG, FIXED POINT
SLOPE2 EQU SLOPE1-4 ;LONG, FIXED POINT
LINE1 EQU SLOPE2-4 ;LONG, FIXED POINT
LINE2 EQU LINE1-4 ;LONG, FIXED POINT
FLAG1 EQU LINE2-2 ;WORD
FLAG2 EQU FLAG1-2 ;WORD
OUTERLEFT EQU FLAG2-2 ;WORD
OUTERRIGHT EQU OUTERLEFT-2 ;WORD
INNERLEFT EQU OUTERRIGHT-2 ;WORD
INNERRIGHT EQU INNERLEFT-2 ;WORD
REALBOUNDS EQU INNERRIGHT-4 ;LONG
VARSIZE EQU REALBOUNDS ;SIZE OF LOCAL VARIABLES
ELSEIF (&CurFile = 'DRAWLINE') THEN
; STACK FRAME VARS USED ONLY BY DRAWLINE
LINERECT EQU hilitColor-8 ;RECT
SAVESTK EQU LINERECT-4 ;LONG
MODECASE EQU SAVESTK-4 ;LONG
LEFTEDGE EQU MODECASE-4 ;LONG, FIXED POINT
RIGHTEDGE EQU LEFTEDGE-4 ;LONG, FIXED POINT
SLOPE EQU RIGHTEDGE-4 ;LONG, FIXED POINT
DSTLEFT EQU SLOPE-4 ;LONG
SAVEA5 EQU DSTLEFT-4 ;LONG
PORT EQU SAVEA5-4 ;LONG
FASTFLAG EQU PORT-2 ;BYTE
CRSRFLAG EQU FASTFLAG-2 ;WORD
BIGRGN EQU CRSRFLAG-4 ;LONG, RgnHandle
REALBOUNDS EQU BIGRGN-4 ;LONG
VARSIZE EQU REALBOUNDS ;SIZE OF LOCAL VARIABLES
ELSEIF (&CurFile = 'DRAWPOLY') THEN
; Stack frame variables used in accord with DrawArc
SAVESTK EQU hilitColor-4 ;LONG
MODECASE EQU SAVESTK-4 ;LONG
DSTLEFT EQU MODECASE-4 ;LONG
TEMPRECTANGLE EQU DSTLEFT-8 ;RECT
FASTFLAG EQU TEMPRECTANGLE-2 ;BYTE
CRSRFLAG EQU FASTFLAG-2 ;SHORT
REALBOUNDS EQU CRSRFLAG-4 ;LONG
; Stack frame variables used only in DrawPoly
FreeList Equ RealBounds-4
StackLimit Equ FreeList-4
ActiveList Equ StackLimit-4
OldStacker Equ ActiveList-4
VarSize Equ OldStacker
ELSEIF ( (&CurFile = 'STRETCH') | (&CurFile = 'RGNBLT') | (&CurFile = 'BITBLT') ) THEN
; MORE SHARED STACK FRAME VARS (STRETCHBITS, RGNBLT, BITBLT)
alignSrcPM EQU hilitColor-2 ;WORD
SRCPIX EQU alignSrcPM-(PMREC+CTREC+20) ;PIXMAP YES
alignMaskPM EQU SRCPIX-2 ;WORD
MASKPIX EQU alignMaskPM-(PMREC+CTREC+20) ;PIXMAP YES
SRCROW EQU MASKPIX-4 ;LONG YES
MASKROW EQU SRCROW-4 ;LONG YES
SRCSHIFT EQU MASKROW-2 ;WORD YES
MASKSHIFT EQU SRCSHIFT-2 ;WORD YES
INVERTFLAG EQU MASKSHIFT-4 ;LONG YES
SAVESTK EQU INVERTFLAG-4 ;LONG YES
SAVEA5 EQU SAVESTK-4 ;LONG YES
SRCBUF EQU SAVEA5-4 ;LONG
DSTBUF EQU SRCBUF-4 ;LONG
SCALEBUF EQU DSTBUF-4 ;LONG
dstBufBump EQU SCALEBUF-4 ;LONG <BAL 17Mar89>
scaleBufBump EQU dstBufBump-4 ;LONG <BAL 17Mar89>
SRCMASKBUF EQU scaleBufBump-4 ;LONG
filler1 EQU SRCMASKBUF-2 ;WORD
SRCLONGS EQU filler1-2 ;WORD
SRCMASKLONGS EQU SRCLONGS-2 ;WORD
DSTMASKLONGS EQU SRCMASKLONGS-2 ;WORD
DSTLONGS EQU DSTMASKLONGS-2 ;WORD
SCALELONGS EQU DSTLONGS-2 ;WORD
SRCADDR EQU SCALELONGS-4 ;LONG
MASKADDR EQU SRCADDR-4 ;LONG
DSTADDR EQU MASKADDR-4 ;LONG
SRCLIMIT EQU DSTADDR-4 ;LONG
NUMER EQU SRCLIMIT-4 ;POINT
DENOM EQU NUMER-4 ;POINT
MASKNUMER EQU DENOM-4 ;POINT
MASKDENOM EQU MASKNUMER-4 ;POINT
MODECASE EQU MASKDENOM-4 ;LONG
; STACK FRAME VARS USED BY STRETCHBITS ONLY
RATIOCASE EQU MODECASE-4 ;LONG
MASKCASE EQU RATIOCASE-4 ;LONG
HORIZFRACTION EQU MASKCASE-2 ;WORD
MASKFRACT EQU HORIZFRACTION-2 ;WORD
SCALECASE EQU MASKFRACT-4 ;LONG
SRCSCANS EQU SCALECASE-2 ;WORD
SRCPIXCNT EQU SRCSCANS-2 ;WORD
SRCALIGN EQU SRCPIXCNT-4 ;LONG
DSTALIGN EQU SRCALIGN-4 ;LONG
MASKALIGN EQU DSTALIGN-4 ;LONG
ScaleTbl EQU MASKALIGN-4 ;LONG
VERROR EQU ScaleTbl-2 ;WORD
CRSRFLAG EQU VERROR-2 ;WORD
REALBOUNDS EQU CRSRFLAG-4 ;LONG
; STACK FRAME VARS USED BY RGNBLT ONLY
FIRSTV EQU REALBOUNDS-2 ;WORD
LASTV EQU FIRSTV-2 ;WORD
VBUMP EQU LASTV-2 ;WORD, MUST BE ABOVE HBUMP
HBUMP EQU VBUMP-2 ;WORD
RGNADDR EQU HBUMP-4 ;LONG
filler2 EQU RGNADDR-2 ;WORD
SRCSIZE EQU filler2-2 ;WORD
SAVESTK2 EQU SRCSIZE-4 ;LONG
; STACK FRAME VARS USED BY BITBLT ONLY
SRCV EQU SAVESTK2-2 ;WORD
DSTV EQU SRCV-2 ;WORD
SRCBUMP EQU DSTV-2 ;WORD
HEIGHT EQU SRCBUMP-2 ;WORD
SRCRECT2 EQU HEIGHT-8 ;RECT
FIRSTMASK EQU SRCRECT2-4 ;LONG
LONGCNT EQU FIRSTMASK-2 ;WORD
; STACK FRAME VARS USED BY RGNBLT/BITBLT
doneMid EQU LONGCNT-1 ;Byte two flags used to control loop
endSwitch EQU doneMid-1 ;Byte three-way switch chooses from src, pat, bigpat
lastMask EQU endSwitch-4 ;Long mask for last long blitted on line
midCount EQU lastMask-2 ;Word # of pixels on line less mask longs - 1
pixInLong EQU midCount-2 ;Word # of pixels in a long - 1
patOffset EQU pixInLong-4 ;Long pattern horizontal initial offset
patPos EQU patOffset-2 ;Word pattern vertical offset
destPixCnt EQU patPos-2 ;word 1-based cnt of pixels to blit<02Mar89 BAL>
destPixOffset EQU destPixCnt-4 ;long destination pixel offset <08Jan89 BAL>
pixInLong1 EQU destPixOffset-2 ;Word same as pixInLong, 1 based (for transparent)
longBump EQU pixInLong1-2 ;Word 32 signed direction of blit (for transparent)
; MORE STACK FRAME VARS USED BY STRETCHBITS ONLY
stITabPtr EQU longBump-4 ;pointer to inverse table (not header) <17Jun88 BAL>
stITabInfo EQU stITabPtr-4 ;pointer to luminance table (not header)<17Mar89 BAL>
stSProc EQU stITabInfo-4 ;head of search proc list <17Jun88 BAL>
stTmpProc EQU stSProc-4 ;working copy of current searchproc <17Jun88 BAL>
stCLUTPtr EQU stTmpProc-4 ;ptr to dst clut for dither <28Jun88 BAL>
stITabRes EQU stCLUTPtr-2 ;inverse table resolution if direct <17Jun88 BAL>
ErrPhase EQU stITabRes-2 ;initial position in src long <07Sep88 BAL>
ErrBuf EQU ErrPhase-4 ;ptr to scan of error values <29Aug88 BAL>
ErrSrcBuf EQU ErrBuf-4 ;ptr to last position in src buf <07Sep88 BAL>
errDir EQU ErrSrcBuf-1 ;err diffusion direction flag <04Sep88 BAL>
useAverage EQU errDir-1 ;scaling quality flag <04Sep88 BAL>
ABufSize EQU useAverage-2 ;long cnt size of AvrgBuf <04Sep88 BAL>
AvrgBuf EQU ABufSize-4 ;ptr to scan of rgb accumulations <04Sep88 BAL>
StackHandle EQU AvrgBuf-4 ;MFTemp memory for alternate stack <09Apr89 BAL>
FastCase EQU StackHandle-1 ;no invert/copy/no stretch/no colorize<03Apr89 BAL>
realDepth EQU FastCase-1 ;byte preserving src depth before RGB conversion <1.5>
realSrcShift EQU realDepth-2 ;word preserving src shift before RGB conversion <1.5>
scaleBltA3 EQU realSrcShift-4 ;value reloaded into A3 by scaleBlt <1.3> BAL
RunBuf2 EQU scaleBltA3-4 ;used for reverse dither run mask <1.3> BAL
oldHiHeapMark EQU RunBuf2-4 ;used during stack swapping <1.3> BAL
srcMergeCase EQU oldHiHeapMark-4 ;routine for vertical src averaging <17Apr90 KON>
maskMergeCase EQU srcMergeCase-4 ;routine for vertical mask averaging<17Apr90 KON>
CombineMaskCase EQU maskMergeCase-4 ;routine to blend src and dst using mask <25Apr90 KON>
MaskError EQU CombineMaskCase-2 ;error for verical mask scaling <17Apr90 KON>
XLateFlag EQU MaskError-2 ;translation flags for mode and colorizing
RGBFrColor EQU XLateFlag-6 ;fg color for colorizing at srcbuf
RGBBgColor EQU RGBFrColor-6 ;bg color for colorizing at srcbuf
SrcPixPmTable EQU RGBBgColor-4 ;32-bit clean pointer to src color table <24AUG90 KON>
MaskPixPmTable EQU SrcPixPmTable-4 ;32-bit clean pointer to mask color table <24AUG90 KON>
newSrcRect EQU MaskPixPmTable-8 ;Rectangle <KON 12NOV90>
newMaskRect EQU newSrcRect-8 ;Rectangle <KON 12NOV90>
newDstRect EQU newMaskRect-8 ;Rectangle <KON 12NOV90>
saveStkLowPt EQU newDstRect-4 ;long value of stklowpt <KON 12NOV90>
stReserved1 EQU saveStkLowPt-4 ;long reserved for patches <17Apr90 KON>
VARSIZE EQU stReserved1 ;SIZE OF LOCAL VARIABLES
ENDIF ;[STRETCH | RGNBLT | BITBLT]
ENDIF ;(!PATEXPAND)
ENDIF ;(!SEEKMASK)