diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-02-06 16:04:01 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-02-06 16:04:01 +0000 |
commit | e6e8aa95197040d5f9e7125819a0a7f047a83f24 (patch) | |
tree | 74665c48ddd0f90067101570fd1bed26f9783a04 /apps/plugins/lib | |
parent | d036e97d3816ac2bc0eefc57bc033bd5fbbbf0f9 (diff) | |
download | rockbox-e6e8aa95197040d5f9e7125819a0a7f047a83f24.tar.gz rockbox-e6e8aa95197040d5f9e7125819a0a7f047a83f24.zip |
Added memmove() to codec API & plugin API, and changed codeclib and plugin libs to use it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8602 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/gray_scroll.c | 35 | ||||
-rw-r--r-- | apps/plugins/lib/xlcd.c | 38 |
2 files changed, 14 insertions, 59 deletions
diff --git a/apps/plugins/lib/gray_scroll.c b/apps/plugins/lib/gray_scroll.c index 341024a67e..89ca2f37c3 100644 --- a/apps/plugins/lib/gray_scroll.c +++ b/apps/plugins/lib/gray_scroll.c | |||
@@ -29,29 +29,6 @@ | |||
29 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 29 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
30 | #include "gray.h" | 30 | #include "gray.h" |
31 | 31 | ||
32 | /* FIXME: intermediate solution until we have properly optimised memmove() */ | ||
33 | static void *my_memmove(void *dst0, const void *src0, size_t len0) | ||
34 | { | ||
35 | char *dst = (char *) dst0; | ||
36 | char *src = (char *) src0; | ||
37 | |||
38 | if (dst <= src) | ||
39 | { | ||
40 | while (len0--) | ||
41 | *dst++ = *src++; | ||
42 | } | ||
43 | else | ||
44 | { | ||
45 | dst += len0; | ||
46 | src += len0; | ||
47 | |||
48 | while (len0--) | ||
49 | *(--dst) = *(--src); | ||
50 | } | ||
51 | |||
52 | return dst0; | ||
53 | } | ||
54 | |||
55 | /*** Scrolling ***/ | 32 | /*** Scrolling ***/ |
56 | 33 | ||
57 | /* Scroll left */ | 34 | /* Scroll left */ |
@@ -68,7 +45,7 @@ void gray_scroll_left(int count) | |||
68 | blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ? | 45 | blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ? |
69 | _gray_info.fg_brightness : _gray_info.bg_brightness; | 46 | _gray_info.fg_brightness : _gray_info.bg_brightness; |
70 | 47 | ||
71 | my_memmove(_gray_info.cur_buffer, _gray_info.cur_buffer + shift, length); | 48 | _gray_rb->memmove(_gray_info.cur_buffer, _gray_info.cur_buffer + shift, length); |
72 | _gray_rb->memset(_gray_info.cur_buffer + length, blank, shift); | 49 | _gray_rb->memset(_gray_info.cur_buffer + length, blank, shift); |
73 | } | 50 | } |
74 | 51 | ||
@@ -86,7 +63,7 @@ void gray_scroll_right(int count) | |||
86 | blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ? | 63 | blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ? |
87 | _gray_info.fg_brightness : _gray_info.bg_brightness; | 64 | _gray_info.fg_brightness : _gray_info.bg_brightness; |
88 | 65 | ||
89 | my_memmove(_gray_info.cur_buffer + shift, _gray_info.cur_buffer, length); | 66 | _gray_rb->memmove(_gray_info.cur_buffer + shift, _gray_info.cur_buffer, length); |
90 | _gray_rb->memset(_gray_info.cur_buffer, blank, shift); | 67 | _gray_rb->memset(_gray_info.cur_buffer, blank, shift); |
91 | } | 68 | } |
92 | 69 | ||
@@ -107,7 +84,7 @@ void gray_scroll_up(int count) | |||
107 | 84 | ||
108 | do | 85 | do |
109 | { | 86 | { |
110 | my_memmove(data, data + count, length); | 87 | _gray_rb->memmove(data, data + count, length); |
111 | _gray_rb->memset(data + length, blank, count); | 88 | _gray_rb->memset(data + length, blank, count); |
112 | data += _gray_info.height; | 89 | data += _gray_info.height; |
113 | } | 90 | } |
@@ -131,7 +108,7 @@ void gray_scroll_down(int count) | |||
131 | 108 | ||
132 | do | 109 | do |
133 | { | 110 | { |
134 | my_memmove(data + count, data, length); | 111 | _gray_rb->memmove(data + count, data, length); |
135 | _gray_rb->memset(data, blank, count); | 112 | _gray_rb->memset(data, blank, count); |
136 | data += _gray_info.height; | 113 | data += _gray_info.height; |
137 | } | 114 | } |
@@ -161,7 +138,7 @@ void gray_ub_scroll_left(int count) | |||
161 | + MULU16(_gray_info.plane_size, _gray_info.depth); | 138 | + MULU16(_gray_info.plane_size, _gray_info.depth); |
162 | do | 139 | do |
163 | { | 140 | { |
164 | my_memmove(ptr_row, ptr_row + count, length); | 141 | _gray_rb->memmove(ptr_row, ptr_row + count, length); |
165 | _gray_rb->memset(ptr_row + length, 0, count); | 142 | _gray_rb->memset(ptr_row + length, 0, count); |
166 | ptr_row += _gray_info.plane_size; | 143 | ptr_row += _gray_info.plane_size; |
167 | } | 144 | } |
@@ -193,7 +170,7 @@ void gray_ub_scroll_right(int count) | |||
193 | + MULU16(_gray_info.plane_size, _gray_info.depth); | 170 | + MULU16(_gray_info.plane_size, _gray_info.depth); |
194 | do | 171 | do |
195 | { | 172 | { |
196 | my_memmove(ptr_row + count, ptr_row, length); | 173 | _gray_rb->memmove(ptr_row + count, ptr_row, length); |
197 | _gray_rb->memset(ptr_row, 0, count); | 174 | _gray_rb->memset(ptr_row, 0, count); |
198 | ptr_row += _gray_info.plane_size; | 175 | ptr_row += _gray_info.plane_size; |
199 | } | 176 | } |
diff --git a/apps/plugins/lib/xlcd.c b/apps/plugins/lib/xlcd.c index 33d807f2f3..a842cf5eb7 100644 --- a/apps/plugins/lib/xlcd.c +++ b/apps/plugins/lib/xlcd.c | |||
@@ -106,28 +106,6 @@ void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | #if LCD_DEPTH >= 8 | 108 | #if LCD_DEPTH >= 8 |
109 | /* FIXME: intermediate solution until we have properly optimised memmove() */ | ||
110 | static void *my_memmove(void *dst0, const void *src0, size_t len0) | ||
111 | { | ||
112 | char *dst = (char *) dst0; | ||
113 | char *src = (char *) src0; | ||
114 | |||
115 | if (dst <= src) | ||
116 | { | ||
117 | while (len0--) | ||
118 | *dst++ = *src++; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | dst += len0; | ||
123 | src += len0; | ||
124 | |||
125 | while (len0--) | ||
126 | *(--dst) = *(--src); | ||
127 | } | ||
128 | |||
129 | return dst0; | ||
130 | } | ||
131 | 109 | ||
132 | void xlcd_scroll_left(int count) | 110 | void xlcd_scroll_left(int count) |
133 | { | 111 | { |
@@ -143,7 +121,7 @@ void xlcd_scroll_left(int count) | |||
143 | 121 | ||
144 | do | 122 | do |
145 | { | 123 | { |
146 | my_memmove(data, data + count, length * sizeof(fb_data)); | 124 | local_rb->memmove(data, data + count, length * sizeof(fb_data)); |
147 | data += LCD_WIDTH; | 125 | data += LCD_WIDTH; |
148 | } | 126 | } |
149 | while (data < data_end); | 127 | while (data < data_end); |
@@ -168,7 +146,7 @@ void xlcd_scroll_right(int count) | |||
168 | 146 | ||
169 | do | 147 | do |
170 | { | 148 | { |
171 | my_memmove(data + count, data, length * sizeof(fb_data)); | 149 | local_rb->memmove(data + count, data, length * sizeof(fb_data)); |
172 | data += LCD_WIDTH; | 150 | data += LCD_WIDTH; |
173 | } | 151 | } |
174 | while (data < data_end); | 152 | while (data < data_end); |
@@ -188,9 +166,9 @@ void xlcd_scroll_up(int count) | |||
188 | 166 | ||
189 | length = LCD_HEIGHT - count; | 167 | length = LCD_HEIGHT - count; |
190 | 168 | ||
191 | my_memmove(local_rb->lcd_framebuffer, | 169 | local_rb->memmove(local_rb->lcd_framebuffer, |
192 | local_rb->lcd_framebuffer + count * LCD_WIDTH, | 170 | local_rb->lcd_framebuffer + count * LCD_WIDTH, |
193 | length * LCD_WIDTH * sizeof(fb_data)); | 171 | length * LCD_WIDTH * sizeof(fb_data)); |
194 | 172 | ||
195 | oldmode = local_rb->lcd_get_drawmode(); | 173 | oldmode = local_rb->lcd_get_drawmode(); |
196 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 174 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
@@ -207,9 +185,9 @@ void xlcd_scroll_down(int count) | |||
207 | 185 | ||
208 | length = LCD_HEIGHT - count; | 186 | length = LCD_HEIGHT - count; |
209 | 187 | ||
210 | my_memmove(local_rb->lcd_framebuffer + count * LCD_WIDTH, | 188 | local_rb->memmove(local_rb->lcd_framebuffer + count * LCD_WIDTH, |
211 | local_rb->lcd_framebuffer, | 189 | local_rb->lcd_framebuffer, |
212 | length * LCD_WIDTH * sizeof(fb_data)); | 190 | length * LCD_WIDTH * sizeof(fb_data)); |
213 | 191 | ||
214 | oldmode = local_rb->lcd_get_drawmode(); | 192 | oldmode = local_rb->lcd_get_drawmode(); |
215 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 193 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |