avr: more work on relative coords->absolute coords
This commit is contained in:
@@ -155,8 +155,8 @@ Widget_OnTouch:
|
||||
breq Widget_OnTouch_secRet ; no press change, jmp
|
||||
|
||||
; check for position inside this widget
|
||||
rcall Widget_LoadDisplayRegs ; (R0-R11)
|
||||
rcall Widget_MakeAbsPos ; (R16, R17) TODO!!!
|
||||
rcall widgetLoadCoordsForFullWidget
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
rcall Widget_IsPointInRect ; (R16, R17)
|
||||
sbci r16, 0 ; r16=ff if touched inside, 0 otherwise
|
||||
|
||||
@@ -271,19 +271,19 @@ Widget_IsPointInRect:
|
||||
mov r17, r19
|
||||
sub r16, r4
|
||||
sbc r17, r5
|
||||
brcs Widget_IsPointInRect_no
|
||||
brcs Widget_IsPointInRect_no ; jmp if left of widget
|
||||
sub r16, r8 ; sub width
|
||||
sbc r17, r9
|
||||
brcc Widget_IsPointInRect_no
|
||||
brcc Widget_IsPointInRect_no ; jmp if right of widget
|
||||
|
||||
mov r16, r20 ; checkY-widgetY
|
||||
mov r17, r21
|
||||
sub r16, r8
|
||||
sbc r17, r9
|
||||
brcs Widget_IsPointInRect_no
|
||||
brcs Widget_IsPointInRect_no ; jmp if above widget
|
||||
sub r16, r10 ; sub height
|
||||
sbc r17, r11
|
||||
brcc Widget_IsPointInRect_no
|
||||
brcc Widget_IsPointInRect_no ; jmp if below widget
|
||||
|
||||
sec ; is inside rect
|
||||
rjmp Widget_IsPointInRect_ret
|
||||
@@ -473,25 +473,12 @@ Widget_SubFlags_ret:
|
||||
Widget_Clear:
|
||||
rcall OBJ_IsObject
|
||||
brcc Widget_Clear_ret
|
||||
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
adiw zh:zl, WIDGET_OFFS_WIDTH_LO
|
||||
lpm r8, Z+ ; WIDTH_LO
|
||||
lpm r9, Z+
|
||||
lpm r10, Z+ ; HEIGHT_LO
|
||||
lpm r11, Z
|
||||
sbiw zh:zl, WIDGET_OFFS_WIDTH_LO+3
|
||||
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
; adiw zh:zl, WIDGET_OFFS_OPTS_LO ; get OPTS low
|
||||
; lpm r14, Z
|
||||
; sbiw zh:zl, WIDGET_OFFS_OPTS_LO
|
||||
rcall Widget_SelectColors ; (R16)
|
||||
mov r2, r0 ; use background
|
||||
rcall widgetLoadCoordsForFullWidget
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
rcall Widget_SelectColors ; (R16)
|
||||
mov r2, r0 ; use background
|
||||
mov r3, r1
|
||||
bigcall Display_FillRect
|
||||
Widget_Clear_ret:
|
||||
@@ -500,10 +487,29 @@ Widget_Clear_ret:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_DrawBorder @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param r3:r2 color
|
||||
; @clobbers any, !Z
|
||||
|
||||
Widget_DrawBorder:
|
||||
rcall OBJ_IsObject
|
||||
brcc Widget_DrawBorder_ret
|
||||
rcall widgetLoadCoordsForFullWidget
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
bigcall Display_DrawRect
|
||||
Widget_DrawBorder_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_SelectColors @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param Y pointer to Widget data in SDRAM
|
||||
; @return r1:r0 background color
|
||||
; @return r3:r2 foreground color
|
||||
@@ -601,25 +607,6 @@ Widget_FillRect:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_DrawBorder @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param r3:r2 color
|
||||
; @clobbers any, !Z
|
||||
|
||||
Widget_DrawBorder:
|
||||
clr r6
|
||||
clr r7
|
||||
clr r8
|
||||
clr r9
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
bigcall Display_DrawRect
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_DrawImage @global
|
||||
;
|
||||
@@ -1276,4 +1263,29 @@ Widget_CalcStringWidthFLASH_done:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_AlignPosXY
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @return r5:r4 X (0)
|
||||
; @return r7:r6 Y (0)
|
||||
; @return r9:r8 widget width
|
||||
; @return r11:R10 widget height
|
||||
|
||||
widgetLoadCoordsForFullWidget:
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
adiw zh:zl, WIDGET_OFFS_WIDTH_LO
|
||||
lpm r8, Z+ ; WIDTH_LO
|
||||
lpm r9, Z+
|
||||
lpm r10, Z+ ; HEIGHT_LO
|
||||
lpm r11, Z
|
||||
sbiw zh:zl, WIDGET_OFFS_WIDTH_LO+3
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user