diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-07-25 20:50:34 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-07-25 20:50:34 +0000 |
commit | c20a00ef3e35b15acf422a2e7f6716abde840c24 (patch) | |
tree | 903cf122a1203360022dad4a06cc24b7ea805463 /apps/plugins/lib/gray_scroll_up.c | |
parent | 12a4ed383f21b65a5a244f47fe1bc9f13d4f63bb (diff) | |
download | rockbox-c20a00ef3e35b15acf422a2e7f6716abde840c24.tar.gz rockbox-c20a00ef3e35b15acf422a2e7f6716abde840c24.zip |
Complete rework of the grayscale library: (1) Implemented the new rockbox graphics api. (2) Added buffered mode, and implemented most drawing functions for buffered mode only. Buffered mode will ease implementation of animated graphics. Some functions are additionally provided as unbuffered versions (drawing grayscale bitmaps, scrolling) since unbuffered mode is better suited for non-animated graphics (JPEG viewer, mandelbrot) and saves some RAM, which is important on Archos. (3) Put all functions in a couple of source files, no more one-function-per-files. This became possible since sectioned compilation for the plugin library and appropriate linking for the pluginswas introduced, otherwise the binaries would be bloated by unused functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7241 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/gray_scroll_up.c')
-rw-r--r-- | apps/plugins/lib/gray_scroll_up.c | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/apps/plugins/lib/gray_scroll_up.c b/apps/plugins/lib/gray_scroll_up.c deleted file mode 100644 index 4c493071af..0000000000 --- a/apps/plugins/lib/gray_scroll_up.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Grayscale framework | ||
11 | * gray_scroll_up() function | ||
12 | * | ||
13 | * This is a generic framework to use grayscale display within Rockbox | ||
14 | * plugins. It obviously does not work for the player. | ||
15 | * | ||
16 | * Copyright (C) 2004 Jens Arnold | ||
17 | * | ||
18 | * All files in this archive are subject to the GNU General Public License. | ||
19 | * See the file COPYING in the source tree root for full license agreement. | ||
20 | * | ||
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
22 | * KIND, either express or implied. | ||
23 | * | ||
24 | ****************************************************************************/ | ||
25 | |||
26 | #ifndef SIMULATOR /* not for simulator by now */ | ||
27 | #include "plugin.h" | ||
28 | |||
29 | #if CONFIG_LCD == LCD_SSD1815 /* only for Recorder/Ondio */ | ||
30 | #include "gray.h" | ||
31 | |||
32 | /*--------------------------------------------------------------------------- | ||
33 | Scroll the whole grayscale buffer up by <count> pixels (<= 7) | ||
34 | ---------------------------------------------------------------------------- | ||
35 | black_border determines if the pixels scrolled in at the bottom are black | ||
36 | or white | ||
37 | |||
38 | Scrolling up/down pixel-wise is significantly slower than scrolling | ||
39 | left/right or scrolling up/down byte-wise because it involves bit | ||
40 | shifting. That's why it is asm optimized. | ||
41 | */ | ||
42 | void gray_scroll_up(int count, bool black_border) | ||
43 | { | ||
44 | unsigned filler; | ||
45 | |||
46 | if ((unsigned) count > 7) | ||
47 | return; | ||
48 | |||
49 | filler = black_border ? 0xFFu : 0; | ||
50 | |||
51 | /* scroll column by column to minimize flicker */ | ||
52 | asm volatile ( | ||
53 | "mov #0,r6 \n" /* x = 0 */ | ||
54 | "mova .su_shifttbl,r0 \n" /* calculate jump destination for */ | ||
55 | "mov.b @(r0,%6),%6 \n" /* shift amount from table */ | ||
56 | "bra .su_cloop \n" /* skip table */ | ||
57 | "add r0,%6 \n" | ||
58 | |||
59 | ".align 2 \n" | ||
60 | ".su_shifttbl: \n" /* shift jump offset table */ | ||
61 | ".byte .su_shift0 - .su_shifttbl \n" | ||
62 | ".byte .su_shift1 - .su_shifttbl \n" | ||
63 | ".byte .su_shift2 - .su_shifttbl \n" | ||
64 | ".byte .su_shift3 - .su_shifttbl \n" | ||
65 | ".byte .su_shift4 - .su_shifttbl \n" | ||
66 | ".byte .su_shift5 - .su_shifttbl \n" | ||
67 | ".byte .su_shift6 - .su_shifttbl \n" | ||
68 | ".byte .su_shift7 - .su_shifttbl \n" | ||
69 | |||
70 | ".su_cloop: \n" /* repeat for every column */ | ||
71 | "mov %1,r2 \n" /* get start address */ | ||
72 | "mov #0,r3 \n" /* current_plane = 0 */ | ||
73 | |||
74 | ".su_oloop: \n" /* repeat for every bitplane */ | ||
75 | "mov r2,r4 \n" /* get start address */ | ||
76 | "mov #0,r5 \n" /* current_row = 0 */ | ||
77 | "mov %5,r1 \n" /* get filler bits */ | ||
78 | |||
79 | ".su_iloop: \n" /* repeat for all rows */ | ||
80 | "sub %2,r4 \n" /* address -= width */ | ||
81 | "mov.b @r4,r0 \n" /* get data byte */ | ||
82 | "shll8 r1 \n" /* old data to 2nd byte */ | ||
83 | "extu.b r0,r0 \n" /* extend unsigned */ | ||
84 | "or r1,r0 \n" /* combine old data */ | ||
85 | "jmp @%6 \n" /* jump into shift "path" */ | ||
86 | "extu.b r0,r1 \n" /* store data for next round */ | ||
87 | |||
88 | ".su_shift6: \n" /* shift right by 0..7 bits */ | ||
89 | "shlr2 r0 \n" | ||
90 | ".su_shift4: \n" | ||
91 | "shlr2 r0 \n" | ||
92 | ".su_shift2: \n" | ||
93 | "bra .su_shift0 \n" | ||
94 | "shlr2 r0 \n" | ||
95 | ".su_shift7: \n" | ||
96 | "shlr2 r0 \n" | ||
97 | ".su_shift5: \n" | ||
98 | "shlr2 r0 \n" | ||
99 | ".su_shift3: \n" | ||
100 | "shlr2 r0 \n" | ||
101 | ".su_shift1: \n" | ||
102 | "shlr r0 \n" | ||
103 | ".su_shift0: \n" | ||
104 | |||
105 | "mov.b r0,@r4 \n" /* store data */ | ||
106 | "add #1,r5 \n" /* current_row++ */ | ||
107 | "cmp/hi r5,%3 \n" /* current_row < bheight ? */ | ||
108 | "bt .su_iloop \n" | ||
109 | |||
110 | "add %4,r2 \n" /* start_address += plane_size */ | ||
111 | "add #1,r3 \n" /* current_plane++ */ | ||
112 | "cmp/hi r3,%0 \n" /* current_plane < depth ? */ | ||
113 | "bt .su_oloop \n" | ||
114 | |||
115 | "add #1,%1 \n" /* start_address++ */ | ||
116 | "add #1,r6 \n" /* x++ */ | ||
117 | "cmp/hi r6,%2 \n" /* x < width ? */ | ||
118 | "bt .su_cloop \n" | ||
119 | : /* outputs */ | ||
120 | : /* inputs */ | ||
121 | /* %0 */ "r"(_graybuf->depth), | ||
122 | /* %1 */ "r"(_graybuf->data + _graybuf->plane_size), | ||
123 | /* %2 */ "r"(_graybuf->width), | ||
124 | /* %3 */ "r"(_graybuf->bheight), | ||
125 | /* %4 */ "r"(_graybuf->plane_size), | ||
126 | /* %5 */ "r"(filler), | ||
127 | /* %6 */ "r"(count) | ||
128 | : /* clobbers */ | ||
129 | "r0", "r1", "r2", "r3", "r4", "r5", "r6" | ||
130 | ); | ||
131 | } | ||
132 | |||
133 | #endif // #ifdef HAVE_LCD_BITMAP | ||
134 | #endif // #ifndef SIMULATOR | ||
135 | |||