avr: take all parents pos into account when calculating abs pos
allows for positions relative to parent in widget tables.
This commit is contained in:
@@ -180,7 +180,7 @@ testWinBodyImg1_flashdata:
|
||||
; WIDGET
|
||||
.db 0, 0 ; opts lo, hi
|
||||
.dw 4 ; X
|
||||
.dw STYLE_WIN_TITLE_HEIGHT+6 ; Y
|
||||
.dw 6 ; Y
|
||||
.dw 96 ; W
|
||||
.dw 96 ; H
|
||||
.dw STYLE_WIN_FOREGROUND ; front color
|
||||
@@ -208,7 +208,7 @@ testWinBodyImg2_flashdata:
|
||||
; WIDGET
|
||||
.db 0, 0 ; opts lo, hi
|
||||
.dw 104 ; X
|
||||
.dw STYLE_WIN_TITLE_HEIGHT+6 ; Y
|
||||
.dw 6 ; Y
|
||||
.dw 96 ; W
|
||||
.dw 96 ; H
|
||||
.dw STYLE_WIN_FOREGROUND ; front color
|
||||
@@ -236,7 +236,7 @@ testWinBodyImg3_flashdata:
|
||||
; WIDGET
|
||||
.db 0, 0 ; opts lo, hi
|
||||
.dw 212 ; X
|
||||
.dw STYLE_WIN_TITLE_HEIGHT+6 ; Y
|
||||
.dw 6 ; Y
|
||||
.dw 96 ; W
|
||||
.dw 96 ; H
|
||||
.dw STYLE_WIN_FOREGROUND ; front color
|
||||
|
||||
@@ -466,15 +466,27 @@ Widget_SelectColors_ret:
|
||||
Widget_MakeAbsPos:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, WIDGET_OFFS_X_LO
|
||||
lpm r16, Z+
|
||||
lpm r17, Z+
|
||||
add r4, r16 ; adjust X
|
||||
adc r5, r17
|
||||
lpm r16, Z+
|
||||
lpm r17, Z+
|
||||
add r6, r16 ; adjust Y
|
||||
adc r7, r17
|
||||
push r18
|
||||
push r19
|
||||
Widget_MakeAbsPos_loop:
|
||||
adiw zh:zl, WIDGET_OFFS_X_LO
|
||||
lpm r16, Z+
|
||||
lpm r17, Z+
|
||||
add r4, r16 ; adjust X
|
||||
adc r5, r17
|
||||
lpm r16, Z+
|
||||
lpm r17, Z
|
||||
add r6, r16 ; adjust Y
|
||||
adc r7, r17
|
||||
sbiw zh:zl, WIDGET_OFFS_X_LO+3
|
||||
rcall OBJ_GetParent
|
||||
brcc Widget_MakeAbsPos_loopEnd
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rjmp Widget_MakeAbsPos_loop
|
||||
Widget_MakeAbsPos_loopEnd:
|
||||
pop r19
|
||||
pop r18
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
@@ -612,15 +624,8 @@ Widget_DrawColoredTextFlash_loopEnd:
|
||||
widgetCalcAbsPosAndBorders:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, WIDGET_OFFS_X_LO
|
||||
lpm r16, Z+ ; widget X
|
||||
lpm r17, Z+
|
||||
add r4, r16 ; adjust X
|
||||
adc r5, r17
|
||||
lpm r16, Z+ ; widget Y
|
||||
lpm r17, Z+
|
||||
add r6, r16 ; adjust Y
|
||||
adc r7, r17
|
||||
rcall Widget_MakeAbsPos ; (R16, R17)
|
||||
adiw zh:zl, WIDGET_OFFS_WIDTH_LO
|
||||
lpm r8, Z+ ; WIDTH_LO
|
||||
lpm r9, Z+
|
||||
add r8, r4 ; convert width to first pos right of widget
|
||||
|
||||
Reference in New Issue
Block a user