freemyipod r7 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r6‎ | r7 | r8 >
Date:22:12, 29 July 2010
Author:theseven
Status:new
Tags:
Comment:
Don't hardwire line stride in text and bitmap drawing
Modified paths:
  • /embios/trunk/drawing.S (modified) (history)
  • /embios/trunk/drawing.h (modified) (history)
  • /embios/trunk/lcdconsole.c (modified) (history)

Diff [purge]

Index: embios/trunk/drawing.h
@@ -32,8 +32,8 @@
3333 #define FONT_HEIGHT 8
3434
3535
36 -void rendertext(void* buffer, int fgcol, int bgcol, char* text);
37 -void renderbmp(void* buffer, void* bitmap);
 36+void rendertext(void* buffer, int fgcol, int bgcol, char* text, int stride);
 37+void renderbmp(void* buffer, void* bitmap, int stride);
3838
3939
4040 #endif
Index: embios/trunk/drawing.S
@@ -30,23 +30,23 @@
3131 sub r2, r2, #0x4d00
3232 subs r2, r2, #0x42
3333 movne pc, lr
34 - str lr, [sp,#-4]
 34+ stmfd sp!, {r4,lr}
3535 ldrh r2, [r1,#18]
3636 ldrh r12, [r1,#20]
3737 orr r2, r2, r12,lsl#16
38 - ldrh r3, [r1,#22]
 38+ ldrh r4, [r1,#22]
3939 ldrh r12, [r1,#24]
40 - orr r3, r3, r12,lsl#16
 40+ orr r4, r4, r12,lsl#16
4141 ldrh lr, [r1,#10]
4242 ldrh r12, [r1,#12]
4343 orr lr, lr, r12,lsl#16
4444 add r1, r1, lr
4545 mov r12, #352
46 - mul lr, r12, r3
 46+ mul lr, r12, r4
4747 add r0, r0, lr
4848 renderbmp_row:
4949 mov r12, r2
50 - sub r0, r0, #352
 50+ sub r0, r0, r3
5151 renderbmp_pixel:
5252 ldrb lr, [r1,#1]
5353 strb lr, [r0], #1
@@ -57,9 +57,9 @@
5858 tst r2, #1
5959 addne r1, r1, #2
6060 sub r0, r0, r2,lsl#1
61 - subs r3, r3, #1
 61+ subs r4, r4, #1
6262 bne renderbmp_row
63 - ldr pc, [sp,#-4]
 63+ ldmfd sp!, {r4,pc}
6464 .size renderbmp, .-renderbmp
6565
6666
@@ -68,7 +68,8 @@
6969 .global renderchar
7070 .type renderchar, %function
7171 renderchar:
72 - stmfd sp!, {r4-r6,lr}
 72+ stmfd sp!, {r4-r7,lr}
 73+ ldr r7, [sp,#0x14]
7374 cmn r2, #1
7475 beq renderchar_nobg
7576 mov r6, r0
@@ -92,7 +93,8 @@
9394 strh lr, [r6], #2
9495 subs r5, r5, #1
9596 bne renderchar_blendcol
96 - add r6, r6, #340
 97+ add r6, r6, r7
 98+ sub r6, r6, #12
9799 subs r4, r4, #1
98100 bne renderchar_blendrow
99101 b renderchar_nobg
@@ -102,7 +104,8 @@
103105 strh r2, [r6], #2
104106 subs r5, r5, #1
105107 bne renderchar_opaquecol
106 - add r6, r6, #340
 108+ add r6, r6, r7
 109+ sub r6, r6, #12
107110 subs r4, r4, #1
108111 bne renderchar_opaquerow
109112 renderchar_nobg:
@@ -118,7 +121,7 @@
119122 renderchar_row:
120123 tst r4, #1
121124 strneh r1, [r6]
122 - add r6, r6, #352
 125+ add r6, r6, r7
123126 movs r4, r4,lsr#1
124127 bne renderchar_row
125128 add r0, r0, #2
@@ -125,7 +128,7 @@
126129 subs r3, r3, #1
127130 bne renderchar_col
128131 add r0, r0, #2
129 - ldmfd sp!, {r4-r6,pc}
 132+ ldmfd sp!, {r4-r7,pc}
130133
131134 renderchar_font:
132135 .byte 0, 0, 0, 0, 0
Index: embios/trunk/lcdconsole.c
@@ -76,7 +76,7 @@
7777 }
7878 renderchar(&framebuf[OFFSETBYTES + ROWBYTES * current_row
7979 + COLBYTES * current_col],
80 - fgcolor, bgcolor, string);
 80+ fgcolor, bgcolor, string, LINEBYTES);
8181 }
8282
8383 void lcdconsole_puts(const char* string, int fgcolor, int bgcolor)