summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox/zxvid_4bpp.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-22 14:20:04 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-22 14:20:04 +0000
commit106ac75ad8229d4c5f66a846609520d22d9d8f0c (patch)
treedefc6786b833bbef4f589070814eee59a8567ba8 /apps/plugins/zxbox/zxvid_4bpp.c
parent95d8590659602080acc7d25f49e7b24b429aa5af (diff)
downloadrockbox-106ac75ad8229d4c5f66a846609520d22d9d8f0c.tar.gz
rockbox-106ac75ad8229d4c5f66a846609520d22d9d8f0c.zip
Adapted most multi-source plugins to the iAudio M3 keypad and screen. Doom and mpegplayer are disabled because of the not yet implemented greyscale library, and zxbox used 2-bit greyscale for now. * Slight optimisation for the (currently unused except on M3) 2-bit greyscale code in zxbox. * Simplified button definitions in chessbox.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16744 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/zxbox/zxvid_4bpp.c')
-rw-r--r--apps/plugins/zxbox/zxvid_4bpp.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/apps/plugins/zxbox/zxvid_4bpp.c b/apps/plugins/zxbox/zxvid_4bpp.c
index c05e48b8e6..5129d17327 100644
--- a/apps/plugins/zxbox/zxvid_4bpp.c
+++ b/apps/plugins/zxbox/zxvid_4bpp.c
@@ -5,13 +5,20 @@
5 5
6#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 6#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
7#define FB_WIDTH ((LCD_WIDTH+3)/4) 7#define FB_WIDTH ((LCD_WIDTH+3)/4)
8unsigned char pixmask[4] ICONST_ATTR = { 8fb_data pixmask[4] ICONST_ATTR = {
9 0xC0, 0x30, 0x0C, 0x03 9 0xC0, 0x30, 0x0C, 0x03
10 }; 10};
11#elif LCD_PIXELFORMAT == VERTICAL_PACKING 11#elif LCD_PIXELFORMAT == VERTICAL_PACKING
12unsigned char pixmask[4] ICONST_ATTR = { 12fb_data pixmask[4] ICONST_ATTR = {
13 0x03, 0x0C, 0x30, 0xC0 13 0x03, 0x0C, 0x30, 0xC0
14}; 14};
15#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
16fb_data pixmask[8] ICONST_ATTR = {
17 0x0101, 0x0202, 0x0404, 0x0808, 0x1010, 0x2020, 0x4040, 0x8080
18};
19fb_data pixval[4] ICONST_ATTR = {
20 0x0000, 0x0001, 0x0100, 0x0101
21};
15#endif 22#endif
16 23
17void init_spect_scr(void) 24void init_spect_scr(void)
@@ -63,8 +70,8 @@ void update_screen(void)
63 srcx = 0; /* reset our x counter before each row... */ 70 srcx = 0; /* reset our x counter before each row... */
64 for(x = 0; x < LCD_WIDTH; x++) 71 for(x = 0; x < LCD_WIDTH; x++)
65 { 72 {
66 mask = pixmask[x & 3]; 73 mask = ~pixmask[x & 3];
67 frameb[x >> 2] = (frameb[x >> 2] & ~mask) | ((image[(srcx>>16)]&0x3) << ((3-(x & 3 )) * 2 )); 74 frameb[x >> 2] = (frameb[x >> 2] & mask) | ((image[(srcx>>16)]&0x3) << ((3-(x & 3 )) * 2 ));
68 srcx += X_STEP; /* move through source image */ 75 srcx += X_STEP; /* move through source image */
69 } 76 }
70 srcy += Y_STEP; /* move through the source image... */ 77 srcy += Y_STEP; /* move through the source image... */
@@ -78,17 +85,34 @@ void update_screen(void)
78 frameb = rb->lcd_framebuffer + (y/4) * LCD_WIDTH; 85 frameb = rb->lcd_framebuffer + (y/4) * LCD_WIDTH;
79 srcx = 0; /* reset our x counter before each row... */ 86 srcx = 0; /* reset our x counter before each row... */
80 shift = ((y & 3 ) * 2 ); 87 shift = ((y & 3 ) * 2 );
81 mask = pixmask[y & 3]; 88 mask = ~pixmask[y & 3];
89 for(x = 0; x < LCD_WIDTH; x++)
90 {
91 frameb[x] = (frameb[x] & mask) | ((image[(srcx>>16)]&0x3) << shift );
92 srcx += X_STEP; /* move through source image */
93 }
94 srcy += Y_STEP; /* move through the source image... */
95 image += (srcy>>16)*WIDTH; /* and possibly to the next row. */
96 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */
97 }
98#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
99 int shift;
100 for(y = 0; y < LCD_HEIGHT; y++)
101 {
102 frameb = rb->lcd_framebuffer + (y/8) * LCD_WIDTH;
103 srcx = 0; /* reset our x counter before each row... */
104 shift = (y & 7);
105 mask = ~pixmask[y & 7];
82 for(x = 0; x < LCD_WIDTH; x++) 106 for(x = 0; x < LCD_WIDTH; x++)
83 { 107 {
84 frameb[x] = (frameb[x] & ~mask) | ((image[(srcx>>16)]&0x3) << shift ); 108 frameb[x] = (frameb[x] & mask) | (pixval[image[(srcx>>16)]&0x3] << shift );
85 srcx += X_STEP; /* move through source image */ 109 srcx += X_STEP; /* move through source image */
86 } 110 }
87 srcy += Y_STEP; /* move through the source image... */ 111 srcy += Y_STEP; /* move through the source image... */
88 image += (srcy>>16)*WIDTH; /* and possibly to the next row. */ 112 image += (srcy>>16)*WIDTH; /* and possibly to the next row. */
89 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */ 113 srcy &= 0xffff; /* set up the y-coordinate between 0 and 1 */
90 } 114 }
91#endif 115#endif
92 116
93 if ( settings.showfps ) { 117 if ( settings.showfps ) {
94 int percent=0; 118 int percent=0;