diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 07:53:33 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 07:53:33 +0000 |
commit | 00ac809cc71e3747c81bf01be95d5cf21d93d9a0 (patch) | |
tree | 4d79755bdc07bdad65e9a524ac8fab572564494d /firmware/drivers/lcd-2bit-horz.c | |
parent | 02eb1d83a79c265b0273e18630553efcf8b9196c (diff) | |
download | rockbox-00ac809cc71e3747c81bf01be95d5cf21d93d9a0.tar.gz rockbox-00ac809cc71e3747c81bf01be95d5cf21d93d9a0.zip |
LCD drivers: * Automatically optimise horizontal and vertical lines drawn via _drawline(), with debug message to show possible optimisations in the caller. * Get rid of the extra ICODE function declarations by putting the attribute into the definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17081 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-2bit-horz.c')
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 195885c072..30901efb98 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -239,43 +239,38 @@ lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | |||
239 | 239 | ||
240 | 240 | ||
241 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 241 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
242 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | 242 | static void ICODE_ATTR flipblock(fb_data *address, unsigned mask, |
243 | ICODE_ATTR; | 243 | unsigned bits) |
244 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | ||
245 | { | 244 | { |
246 | *address ^= bits & mask; | 245 | *address ^= bits & mask; |
247 | } | 246 | } |
248 | 247 | ||
249 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | 248 | static void ICODE_ATTR bgblock(fb_data *address, unsigned mask, |
250 | ICODE_ATTR; | 249 | unsigned bits) |
251 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | ||
252 | { | 250 | { |
253 | unsigned data = *address; | 251 | unsigned data = *address; |
254 | 252 | ||
255 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 253 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
256 | } | 254 | } |
257 | 255 | ||
258 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | 256 | static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask, |
259 | ICODE_ATTR; | 257 | unsigned bits) |
260 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
261 | { | 258 | { |
262 | unsigned data = *address; | 259 | unsigned data = *address; |
263 | 260 | ||
264 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); | 261 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); |
265 | } | 262 | } |
266 | 263 | ||
267 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 264 | static void ICODE_ATTR fgblock(fb_data *address, unsigned mask, |
268 | ICODE_ATTR; | 265 | unsigned bits) |
269 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | ||
270 | { | 266 | { |
271 | unsigned data = *address; | 267 | unsigned data = *address; |
272 | 268 | ||
273 | *address = data ^ ((data ^ fg_pattern) & mask & bits); | 269 | *address = data ^ ((data ^ fg_pattern) & mask & bits); |
274 | } | 270 | } |
275 | 271 | ||
276 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | 272 | static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, |
277 | ICODE_ATTR; | 273 | unsigned bits) |
278 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | ||
279 | { | 274 | { |
280 | unsigned data = *address; | 275 | unsigned data = *address; |
281 | unsigned bgp = bg_pattern; | 276 | unsigned bgp = bg_pattern; |
@@ -284,9 +279,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) | |||
284 | *address = data ^ ((data ^ bits) & mask); | 279 | *address = data ^ ((data ^ bits) & mask); |
285 | } | 280 | } |
286 | 281 | ||
287 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | 282 | static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, |
288 | ICODE_ATTR; | 283 | unsigned bits) |
289 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
290 | { | 284 | { |
291 | unsigned data = *address; | 285 | unsigned data = *address; |
292 | unsigned bgp = *(address + lcd_backdrop_offset); | 286 | unsigned bgp = *(address + lcd_backdrop_offset); |
@@ -295,43 +289,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | |||
295 | *address = data ^ ((data ^ bits) & mask); | 289 | *address = data ^ ((data ^ bits) & mask); |
296 | } | 290 | } |
297 | 291 | ||
298 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 292 | static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask, |
299 | ICODE_ATTR; | 293 | unsigned bits) |
300 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
301 | { | 294 | { |
302 | *address ^= ~bits & mask; | 295 | *address ^= ~bits & mask; |
303 | } | 296 | } |
304 | 297 | ||
305 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | 298 | static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask, |
306 | ICODE_ATTR; | 299 | unsigned bits) |
307 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
308 | { | 300 | { |
309 | unsigned data = *address; | 301 | unsigned data = *address; |
310 | 302 | ||
311 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 303 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
312 | } | 304 | } |
313 | 305 | ||
314 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | 306 | static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask, |
315 | ICODE_ATTR; | 307 | unsigned bits) |
316 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
317 | { | 308 | { |
318 | unsigned data = *address; | 309 | unsigned data = *address; |
319 | 310 | ||
320 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); | 311 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); |
321 | } | 312 | } |
322 | 313 | ||
323 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 314 | static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask, |
324 | ICODE_ATTR; | 315 | unsigned bits) |
325 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
326 | { | 316 | { |
327 | unsigned data = *address; | 317 | unsigned data = *address; |
328 | 318 | ||
329 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); | 319 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); |
330 | } | 320 | } |
331 | 321 | ||
332 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | 322 | static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, |
333 | ICODE_ATTR; | 323 | unsigned bits) |
334 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
335 | { | 324 | { |
336 | unsigned data = *address; | 325 | unsigned data = *address; |
337 | unsigned fgp = fg_pattern; | 326 | unsigned fgp = fg_pattern; |
@@ -340,9 +329,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | |||
340 | *address = data ^ ((data ^ bits) & mask); | 329 | *address = data ^ ((data ^ bits) & mask); |
341 | } | 330 | } |
342 | 331 | ||
343 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | 332 | static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, |
344 | ICODE_ATTR; | 333 | unsigned bits) |
345 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
346 | { | 334 | { |
347 | unsigned data = *address; | 335 | unsigned data = *address; |
348 | unsigned fgp = fg_pattern; | 336 | unsigned fgp = fg_pattern; |
@@ -459,8 +447,20 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
459 | int y, yinc1, yinc2; | 447 | int y, yinc1, yinc2; |
460 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; | 448 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; |
461 | 449 | ||
462 | deltax = abs(x2 - x1); | ||
463 | deltay = abs(y2 - y1); | 450 | deltay = abs(y2 - y1); |
451 | if (deltay == 0) | ||
452 | { | ||
453 | DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n"); | ||
454 | lcd_hline(x1, x2, y1); | ||
455 | return; | ||
456 | } | ||
457 | deltax = abs(x2 - x1); | ||
458 | if (deltax == 0) | ||
459 | { | ||
460 | DEBUGF("lcd_drawline() called for vertical line - optimisation.\n"); | ||
461 | lcd_vline(x1, y1, y2); | ||
462 | return; | ||
463 | } | ||
464 | xinc2 = 1; | 464 | xinc2 = 1; |
465 | yinc2 = 1; | 465 | yinc2 = 1; |
466 | 466 | ||
@@ -702,11 +702,9 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
702 | * 0..7, the second row defines pixel row 8..15 etc. */ | 702 | * 0..7, the second row defines pixel row 8..15 etc. */ |
703 | 703 | ||
704 | /* Draw a partial monochrome bitmap */ | 704 | /* Draw a partial monochrome bitmap */ |
705 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | 705 | void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, |
706 | int stride, int x, int y, int width, int height) | 706 | int src_y, int stride, int x, int y, |
707 | ICODE_ATTR; | 707 | int width, int height) |
708 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
709 | int stride, int x, int y, int width, int height) | ||
710 | { | 708 | { |
711 | int ny, nx, ymax; | 709 | int ny, nx, ymax; |
712 | const unsigned char * src_end; | 710 | const unsigned char * src_end; |
@@ -795,11 +793,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
795 | * This is the same as the internal lcd hw format. */ | 793 | * This is the same as the internal lcd hw format. */ |
796 | 794 | ||
797 | /* Draw a partial native bitmap */ | 795 | /* Draw a partial native bitmap */ |
798 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | 796 | void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, |
799 | int stride, int x, int y, int width, int height) | 797 | int src_y, int stride, int x, int y, |
800 | ICODE_ATTR; | 798 | int width, int height) |
801 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
802 | int stride, int x, int y, int width, int height) | ||
803 | { | 799 | { |
804 | int shift, nx; | 800 | int shift, nx; |
805 | unsigned char *dst, *dst_end; | 801 | unsigned char *dst, *dst_end; |