mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-04 03:32:12 +00:00
LIBGUI:Clipping stuff
This commit is contained in:
parent
116664cbee
commit
c481b84d0b
Binary file not shown.
@ -88,7 +88,9 @@ CB.Cache2CBBuf
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CB.FlushBufToYA jsr CLIP.GetInCache
|
||||
* Y,A = Target Object
|
||||
*--------------------------------------
|
||||
CB.FlushBufToYA jsr CLIP.GetRect
|
||||
|
||||
lda hCBBuf
|
||||
beq .8
|
||||
|
@ -3,14 +3,12 @@ NEW
|
||||
*--------------------------------------
|
||||
* CLIPPING Functions:
|
||||
* In:
|
||||
* Graphic Context in CLIP.Cache
|
||||
* Target Clipping Region in CLIP.Rect
|
||||
* YA = Control Block
|
||||
* Out:
|
||||
* CC : CB.Cache clipped & visible
|
||||
* CS : CB.Cache invisible
|
||||
*--------------------------------------
|
||||
CLIP.YA jsr CB.GetInCache
|
||||
|
||||
CLIP.CB.Cache lda CB.Cache+S.CB.CMD
|
||||
and #$7F remove S.CB.CMD.OSD
|
||||
tax
|
||||
@ -21,17 +19,17 @@ CLIP.Point
|
||||
rts
|
||||
*--------------------------------------
|
||||
CLIP.HLine >LDYA CB.Cache+S.CB.Y1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.Y2
|
||||
>SCMPYA CLIP.Rect+S.RECT.Y2
|
||||
bpl .9
|
||||
|
||||
>LDYA CB.Cache+S.CB.Y1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.Y1
|
||||
>SCMPYA CLIP.Rect+S.RECT.Y1
|
||||
bmi .9
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.X1
|
||||
>LDYA CLIP.Rect+S.RECT.X1
|
||||
>STYAIFGTR CB.Cache+S.CB.X1
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.X2
|
||||
>LDYA CLIP.Rect+S.RECT.X2
|
||||
>STYAIFLWR CB.Cache+S.CB.X2
|
||||
|
||||
clc
|
||||
@ -41,17 +39,17 @@ CLIP.HLine >LDYA CB.Cache+S.CB.Y1
|
||||
rts
|
||||
*--------------------------------------
|
||||
CLIP.VLine >LDYA CB.Cache+S.CB.X1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.X2
|
||||
>SCMPYA CLIP.Rect+S.RECT.X2
|
||||
bpl .9
|
||||
|
||||
>LDYA CB.Cache+S.CB.X1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.X1
|
||||
>SCMPYA CLIP.Rect+S.RECT.X1
|
||||
bmi .9
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.Y1
|
||||
>LDYA CLIP.Rect+S.RECT.Y1
|
||||
>STYAIFGTR CB.Cache+S.CB.Y1
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.Y2
|
||||
>LDYA CLIP.Rect+S.RECT.Y2
|
||||
>STYAIFLWR CB.Cache+S.CB.Y2
|
||||
|
||||
clc
|
||||
@ -60,19 +58,19 @@ CLIP.VLine >LDYA CB.Cache+S.CB.X1
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CLIP.Rect jsr CLIP.Cache.Overlap
|
||||
CLIP.Rectangle jsr CLIP.Rect.Overlap
|
||||
bcs .9
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.X1
|
||||
>LDYA CLIP.Rect+S.RECT.X1
|
||||
>STYAIFGTR CB.Cache+S.CB.X1
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.X2
|
||||
>LDYA CLIP.Rect+S.RECT.X2
|
||||
>STYAIFLWR CB.Cache+S.CB.X2
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.Y1
|
||||
>LDYA CLIP.Rect+S.RECT.Y1
|
||||
>STYAIFGTR CB.Cache+S.CB.Y1
|
||||
|
||||
>LDYA CLIP.Cache+S.OBJ.Y2
|
||||
>LDYA CLIP.Rect+S.RECT.Y2
|
||||
>STYAIFLWR CB.Cache+S.CB.Y2
|
||||
|
||||
clc
|
||||
@ -89,15 +87,15 @@ CLIP.Text.RTS rts
|
||||
*--------------------------------------
|
||||
CLIP.BitBlt jsr CB.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
|
||||
|
||||
jsr CLIP.Cache.Overlap
|
||||
jsr CLIP.Rect.Overlap
|
||||
bcs CLIP.Text.RTS
|
||||
|
||||
lda CLIP.Cache+S.OBJ.X1
|
||||
lda CLIP.Rect+S.RECT.X1
|
||||
sec
|
||||
sbc CB.Cache+S.CB.X1
|
||||
sta DX
|
||||
|
||||
lda CLIP.Cache+S.OBJ.X1+1
|
||||
lda CLIP.Rect+S.RECT.X1+1
|
||||
sbc CB.Cache+S.CB.X1+1
|
||||
sta DX+1
|
||||
bvc .1
|
||||
@ -134,11 +132,11 @@ CLIP.BitBlt jsr CB.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
|
||||
|
||||
.2 lda CB.Cache+S.CB.X2
|
||||
sec
|
||||
sbc CLIP.Cache+S.OBJ.X2
|
||||
sbc CLIP.Rect+S.RECT.X2
|
||||
sta DX
|
||||
|
||||
lda CB.Cache+S.CB.X2+1
|
||||
sbc CLIP.Cache+S.OBJ.X2+1
|
||||
sbc CLIP.Rect+S.RECT.X2+1
|
||||
sta DX+1
|
||||
bvc .3
|
||||
eor #$80
|
||||
@ -154,12 +152,12 @@ CLIP.BitBlt jsr CB.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
|
||||
sta CB.Cache+S.CB.SrcW+1
|
||||
bcc .9
|
||||
|
||||
.4 lda CLIP.Cache+S.OBJ.Y1
|
||||
.4 lda CLIP.Rect+S.RECT.Y1
|
||||
sec
|
||||
sbc CB.Cache+S.CB.Y1
|
||||
sta DX
|
||||
|
||||
lda CLIP.Cache+S.OBJ.Y1+1
|
||||
lda CLIP.Rect+S.RECT.Y1+1
|
||||
sbc CB.Cache+S.CB.Y1+1
|
||||
sta DX+1
|
||||
bvc .5
|
||||
@ -196,11 +194,11 @@ CLIP.BitBlt jsr CB.SetX2Y2 set X2=X1+W-1 Y2=X1+H-1
|
||||
|
||||
.6 lda CB.Cache+S.CB.Y2
|
||||
sec
|
||||
sbc CLIP.Cache+S.OBJ.Y2
|
||||
sbc CLIP.Rect+S.RECT.Y2
|
||||
sta DX
|
||||
|
||||
lda CB.Cache+S.CB.Y2+1
|
||||
sbc CLIP.Cache+S.OBJ.Y2+1
|
||||
sbc CLIP.Rect+S.RECT.Y2+1
|
||||
sta DX+1
|
||||
bvc .7
|
||||
eor #$80
|
||||
@ -228,7 +226,6 @@ CLIP.Line.BOTTOM .EQ 4
|
||||
CLIP.Line.TOP .EQ 8
|
||||
*--------------------------------------
|
||||
CLIP.Line jsr CLIP.Line.EncodeP1
|
||||
>DEBUG
|
||||
jsr CLIP.Line.EncodeP2
|
||||
|
||||
.1 lda CLIP.Line.P1
|
||||
@ -339,7 +336,7 @@ CLIP.Line.EncodeP2
|
||||
*--------------------------------------
|
||||
CLIP.Line.EncodeX.AX
|
||||
pha
|
||||
>SCMPAX CLIP.Cache+S.OBJ.X1
|
||||
>SCMPAX CLIP.Rect+S.RECT.X1
|
||||
bpl .1
|
||||
|
||||
pla
|
||||
@ -351,7 +348,7 @@ CLIP.Line.EncodeX.AX
|
||||
rts
|
||||
|
||||
.1 pla
|
||||
>SCMPAX CLIP.Cache+S.OBJ.X2
|
||||
>SCMPAX CLIP.Rect+S.RECT.X2
|
||||
bmi .8
|
||||
|
||||
tya
|
||||
@ -362,7 +359,7 @@ CLIP.Line.EncodeX.AX
|
||||
*--------------------------------------
|
||||
CLIP.Line.EncodeY.AX
|
||||
pha
|
||||
>SCMPAX CLIP.Cache+S.OBJ.Y1
|
||||
>SCMPAX CLIP.Rect+S.RECT.Y1
|
||||
bpl .1
|
||||
|
||||
pla
|
||||
@ -373,7 +370,7 @@ CLIP.Line.EncodeY.AX
|
||||
rts
|
||||
|
||||
.1 pla
|
||||
>SCMPAX CLIP.Cache+S.OBJ.Y2
|
||||
>SCMPAX CLIP.Rect+S.RECT.Y2
|
||||
bmi .8
|
||||
|
||||
tya
|
||||
@ -382,21 +379,21 @@ CLIP.Line.EncodeY.AX
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CLIP.Cache.Overlap
|
||||
CLIP.Rect.Overlap
|
||||
>LDYA CB.Cache+S.CB.X1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.X2
|
||||
>SCMPYA CLIP.Rect+S.RECT.X2
|
||||
bpl .9
|
||||
|
||||
>LDYA CB.Cache+S.CB.X2
|
||||
>SCMPYA CLIP.Cache+S.OBJ.X1
|
||||
>SCMPYA CLIP.Rect+S.RECT.X1
|
||||
bmi .9
|
||||
|
||||
>LDYA CB.Cache+S.CB.Y1
|
||||
>SCMPYA CLIP.Cache+S.OBJ.Y2
|
||||
>SCMPYA CLIP.Rect+S.RECT.Y2
|
||||
bpl .9
|
||||
|
||||
>LDYA CB.Cache+S.CB.Y2
|
||||
>SCMPYA CLIP.Cache+S.OBJ.Y1
|
||||
>SCMPYA CLIP.Rect+S.RECT.Y1
|
||||
bmi .9
|
||||
|
||||
clc
|
||||
@ -405,12 +402,14 @@ CLIP.Cache.Overlap
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CLIP.GetInCache >STYA .1+1
|
||||
CLIP.GetRect >STYA .1+1
|
||||
|
||||
ldx #S.OBJ-1
|
||||
ldy #S.OBJ.Y2+1
|
||||
ldx #7
|
||||
|
||||
.1 lda $ffff,x SELF MODIFIED
|
||||
sta CLIP.Cache,x
|
||||
.1 lda $ffff,y
|
||||
sta CLIP.Rect,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
|
@ -50,11 +50,11 @@ DRAW.Line jsr DRAW.PullY2X2Y1X1
|
||||
lda #S.CB.CMD.HLINE DY=0 : HLINE X1,X2 At Y1
|
||||
|
||||
.20 sta CB.Cache+S.CB.CMD
|
||||
* >DEBUG
|
||||
|
||||
jsr CLIP.CB.Cache
|
||||
bcs .8
|
||||
|
||||
jmp CB.GFXWrite
|
||||
jsr CB.GFXWrite
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
@ -63,7 +63,7 @@ DRAW.Line jsr DRAW.PullY2X2Y1X1
|
||||
lda #$ff
|
||||
sta IY set IY=-1
|
||||
|
||||
.4
|
||||
.4
|
||||
* jsr CLIP.Line
|
||||
* bcs .8
|
||||
|
||||
@ -309,6 +309,38 @@ DRAW.BitMap lda #S.CB.CMD.BITBLT
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* drawtext (short int hWND, short int OP, short int hFONT, int X1, int Y1, char *str)
|
||||
*--------------------------------------
|
||||
DRAW.Text lda #S.CB.CMD.DRAWTEXT2
|
||||
jsr CB.InitCacheA
|
||||
|
||||
>PULLW CB.Cache+S.CB.TxtPtr
|
||||
|
||||
jsr DRAW.PullY1X1
|
||||
|
||||
>PULLB CB.Cache+S.CB.hFont
|
||||
>PULLB CB.Cache+S.CB.OP
|
||||
|
||||
jsr DRAW.PullInnerWND
|
||||
|
||||
jsr CLIP.CB.Cache
|
||||
bcs .8
|
||||
|
||||
jmp CB.GFXWrite
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRAW.PullInnerWND
|
||||
jsr OBJ.PullHWND get dest window at ZPWNDPtr
|
||||
|
||||
jsr DRAW.GetInnerWND get inners in CLIP.Rect
|
||||
|
||||
>LDYA ZPWNDPtr
|
||||
jmp CB.ToGlobal set CB.Cache to global coord.
|
||||
*--------------------------------------
|
||||
* private
|
||||
*--------------------------------------
|
||||
DRAW.xBM >LDYA L.BMs,x
|
||||
DRAW.yaBM >STYA ZPBMPtr
|
||||
|
||||
@ -339,28 +371,6 @@ DRAW.BM lda #S.CB.CMD.BITBLT
|
||||
|
||||
jmp CB.Cache2CBBuf
|
||||
*--------------------------------------
|
||||
* drawtext (short int hWND, short int OP, short int hFONT, int X1, int Y1, char *str)
|
||||
*--------------------------------------
|
||||
DRAW.Text lda #S.CB.CMD.DRAWTEXT2
|
||||
jsr CB.InitCacheA
|
||||
|
||||
>PULLW CB.Cache+S.CB.TxtPtr
|
||||
|
||||
jsr DRAW.PullY1X1
|
||||
|
||||
>PULLB CB.Cache+S.CB.hFont
|
||||
>PULLB CB.Cache+S.CB.OP
|
||||
|
||||
jsr DRAW.PullInnerWND
|
||||
|
||||
jsr CLIP.CB.Cache
|
||||
bcs .8
|
||||
|
||||
jmp CB.GFXWrite
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRAW.YAText >STYA CB.Cache+S.CB.TxtPtr
|
||||
stx CB.Cache+S.CB.hFont
|
||||
|
||||
@ -396,48 +406,38 @@ DRAW.PullX >PULLA
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRAW.PullInnerWND
|
||||
jsr OBJ.PullHWND get dest window at ZPWNDPtr
|
||||
|
||||
jsr DRAW.GetInnerWND get inners in CLIP.Cache
|
||||
|
||||
>LDYA ZPWNDPtr
|
||||
jmp CB.ToGlobal set CB.Cache to global coord.
|
||||
*--------------------------------------
|
||||
DRAW.GetInnerWND
|
||||
ldy #S.OBJ.X1
|
||||
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.X1
|
||||
sta CLIP.Rect+S.RECT.X1
|
||||
iny
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.X1+1
|
||||
sta CLIP.Rect+S.RECT.X1+1
|
||||
|
||||
ldy #S.WND.InnerY1
|
||||
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.Y1
|
||||
sta CLIP.Rect+S.RECT.Y1
|
||||
iny
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.Y1+1
|
||||
sta CLIP.Rect+S.RECT.Y1+1
|
||||
|
||||
ldy #S.WND.InnerW
|
||||
ldy #S.WND.InnerX2
|
||||
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.W
|
||||
sta CLIP.Rect+S.RECT.X2
|
||||
iny
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.W+1
|
||||
sta CLIP.Rect+S.RECT.X2+1
|
||||
|
||||
ldy #S.WND.InnerH
|
||||
ldy #S.WND.InnerY2
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.H
|
||||
sta CLIP.Rect+S.RECT.Y2
|
||||
iny
|
||||
lda (ZPWNDPtr),y
|
||||
sta CLIP.Cache+S.OBJ.H+1
|
||||
|
||||
>LDYA L.CLIP.Cache
|
||||
jmp OBJ.SetX2Y2 set X2 = X1 + W - 1...
|
||||
sta CLIP.Rect+S.RECT.Y2+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/lib/libgui.s.draw
|
||||
|
@ -156,12 +156,14 @@ PTR.Show.I ldx PTR.T
|
||||
lda #S.CB.OP.ORA+S.CB.OP.MASK+S.CB.OP.SAVE
|
||||
|
||||
PTR.Draw.I sta CB.PTR+S.CB.OP
|
||||
|
||||
|
||||
>LDYA L.WND.Screen
|
||||
jsr CLIP.GetInCache
|
||||
jsr CLIP.GetRect
|
||||
|
||||
>LDYA L.CB.PTR
|
||||
jsr CLIP.YA
|
||||
jsr CB.GetInCache
|
||||
|
||||
jsr CLIP.CB.Cache
|
||||
bcs .8
|
||||
|
||||
jsr CB.GFXWrite
|
||||
|
@ -152,8 +152,8 @@ L.MouseClamp .DA MouseClamp
|
||||
L.MSG .DA MSG
|
||||
L.MSG.XY .DA MSG+S.MSG.X1
|
||||
L.CB.PTR .DA CB.PTR
|
||||
L.CLIP.Rect .DA CLIP.Rect
|
||||
L.CB.Cache .DA CB.Cache
|
||||
L.CLIP.Cache .DA CLIP.Cache
|
||||
L.WND.Screen .DA WND.Screen
|
||||
L.WND.Desktop .DA WND.Desktop
|
||||
L.WND.SysBar .DA WND.SysBar
|
||||
@ -198,9 +198,9 @@ J.Clip .DA CLIP.Point SETPIXEL
|
||||
.DA CLIP.Point GETPIXEL
|
||||
.DA CLIP.HLine HLINE
|
||||
.DA CLIP.VLine VLINE
|
||||
.DA CLIP.Rect FILLRECT
|
||||
.DA CLIP.Rectangle FILLRECT
|
||||
.DA CLIP.BitBlt BITBLT
|
||||
.DA CLIP.Rect GETRECTBUFSIZE
|
||||
.DA CLIP.Rectangle GETRECTBUFSIZE
|
||||
.DA CLIP.Text DRAWTEXT
|
||||
.DA CLIP.Text GETTEXTSIZE
|
||||
.DA CLIP.Line DRAWLINE
|
||||
@ -345,8 +345,8 @@ CB.PTR .DA #S.CB.CMD.BITBLT
|
||||
.DA #0
|
||||
.BS S.CB-4
|
||||
*--------------------------------------
|
||||
CLIP.Rect .BS S.RECT
|
||||
CB.Cache .BS S.CB
|
||||
CLIP.Cache .BS S.OBJ
|
||||
*--------------------------------------
|
||||
MENU.Stack.Owner .BS 1
|
||||
MENU.Stack.Idx .BS 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user