antoine-source/appleworksgs/Pict/Src/region.aii

1 line
15 KiB
Plaintext
Raw Normal View History

2023-03-04 02:45:20 +00:00
LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_ChangePictSize IMPORT Q_Copy2 IMPORT Q_JustRect IMPORT D_NeedHandle IMPORT Q_Nop IMPORT D_ZeroBlock IMPORT Q_addbytes IMPORT Q_center IMPORT count IMPORT Q_half IMPORT newptr IMPORT oldptr IMPORT Q_pictSCB IMPORT Q_picterr IMPORT Q_printsquare IMPORT Q_square import temp IMPORT thepoint IMPORT what ENTRY Q_FlipHRgn ENTRY Q_FlipVRgn ENTRY MangleRgn ENTRY Q_RotLRgn ENTRY Q_RotRRgn ENTRY Q_flipdx ENTRY flipdy **************************************************************** * ; * Q_Region flipping and rotating routines ; *______________________________________________________________* * ; * Q_MangleRegion(rgn:l,what:w,prerec:l):newrgn:l ; *______________________________________________________________* * ; * NOTE! The Apple Q_Region data structure is proprietary, ; * and as such, this code may legally belong to Apple, if ; * they ask for it. ; * ; **************************************************************** *--------------------------------------------------------------* * Copy a Q_Region picture opcode and mangle its data ; *--------------------------------------------------------------* Q_Region PROC EXPORT ;Using Q_PictData EXPORT Q_JustRgn jsl Q_Nop ; copy the opcode Q_JustRgn ; cmpw [<oldptr],#10 jeq nomore spacelong ; get a handle for the Q_Region pushword #0 ; high word of size pushword [<oldptr] pushword #$8000 ; X_Locked! jsl D_NeedHandle sta Q_picterr pulllong <thepoint jcs abort movelong [<thepoint],<temp pushlong <oldptr ; copy the Q_Region data into the handle pushlong <temp pushword #0 pushword [<oldptr] _BlockMove moveword [<oldptr],<count addwl <count,<oldptr cmpw <what,#Q_rotr blt doit lda Q_pictSCB beq doit pushlong <thepoint pushlong #Q_square pushlong #Q_half _MapRgn doit spacelong pushlong <thepoint ; mangle the Q_Region! jtl MangleRgn,<what sta Q_picterr pushlong <thepoint ; out with the old _DisposeHandle pulllong <thepoint ; ...in with the D_New cmpw Q_picterr,#1 jcs abort cmpw <what,#Q_rotr blt didit lda Q_pictSCB beq didit pushlong <thepoint pushlong #Q_half pushlong #Q_square _MapRgn didit pushlong <thepoint _Hlock movelong [<thepoint],<temp cmpw [<temp],<count ; did the Q_Region size change? beq samesize stz Q_addbytes+2 subword [<temp],<count,Q_addbytes bpl changeit dec Q_addbytes+2 changeit jsl Q_ChangePictSize ; if so, make room in the pict bcs abort movelong [<thepoint],<temp ; (restore temp) moveword [<temp],<count samesize pushlong <temp ; copy the D_New Q_Region into the pict pushlong <newptr pushword #0 pushword <count _BlockMove addwl <count,<newptr pushlong <thepoint _DisposeHandle bra exit nomore jsl Q_Copy2 ; copy the size jsl Q_JustRect ; mangle the bounds exit clc abort rtl ENDP **************************************************************** * * Q_MangleRegion(rgn:l,what:w,prrec:l):newrgn:l -- mangle a Q_Region * **************************************************************** Q_MangleRegion PROC EXPORT ;Using Q_PictData EXPORT MangleRgn input oldrgn:l,how:w,prrec:l output newrgn:l local rptr:l,prptr:l begin +b cmpw how,#2 blt norot1 movelong [prrec],prptr movelong [prptr]:#4,Q_printsquare+4 pushlong oldrgn pushlong #Q_printsquare pushlong #Q_square _MapRgn norot1 pushlong oldrgn _Hlock movelong [oldrgn],rptr addword [rptr]:#2,[rptr]:#6,Q_center ; get the 'Q_center' of addword [rptr]:#4,[rptr]:#8,Q_center+2 ; the old Q_Region norot spacelong pushlong oldrgn jtl MangleRgn,how sta Q_picterr pulllong newrgn pushlong oldrgn _HunLock cmpw how,#2 blt exit pushlong newrgn pushlong #Q_square pushlong #Q_printsquare _MapRgn exit return Q_picterr MangleRgn