summaryrefslogtreecommitdiff
path: root/uisimulator/x11
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-07-06 22:58:02 +0000
committerJens Arnold <amiconn@rockbox.org>2005-07-06 22:58:02 +0000
commitf894a4c2691fbde1758a05407cb5eadcaec4a6c8 (patch)
tree46cb7ce63c794020175ab251cf0299663be8bf3c /uisimulator/x11
parent1076eb1d2720b88757616f642be0c39c6a3b76df (diff)
downloadrockbox-f894a4c2691fbde1758a05407cb5eadcaec4a6c8.tar.gz
rockbox-f894a4c2691fbde1758a05407cb5eadcaec4a6c8.zip
4-shades greyscale graphics core for iriver H1x0. 4-grey rockbox logo and light grey background in splash() boxes. Simplified the splash() box creation as the new graphics core does clipping. Adapted screendump feature and added flexible preprocessing to construct the bmp header. Rockboy now uses 4-grey mode as well. 4-grey support for win32 simulator. Fixed win32 player sim to not use double bitmap conversion via a recorder-like framebuffer, and correctly display double-height text. X11 simulator temporarily adapted. The display won't be distorted, but it still shows b&w only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7046 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11')
-rw-r--r--uisimulator/x11/lcd-x11.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index 1ee15f9169..d538cee9df 100644
--- a/uisimulator/x11/lcd-x11.c
+++ b/uisimulator/x11/lcd-x11.c
@@ -40,11 +40,19 @@
40#include "lcd-x11.h" 40#include "lcd-x11.h"
41#include "lcd-playersim.h" 41#include "lcd-playersim.h"
42 42
43extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; 43#if LCD_DEPTH == 2
44#define YBLOCK 4
45#define BITOFFS 1 /* take the MSB of each pixel */
46#else
47#define YBLOCK 8
48#define BITOFFS 0
49#endif
50
44extern void screen_resized(int width, int height); 51extern void screen_resized(int width, int height);
45 52
46#ifdef HAVE_LCD_BITMAP 53#ifdef HAVE_LCD_BITMAP
47unsigned char lcd_framebuffer_copy[LCD_HEIGHT/8][LCD_WIDTH]; 54extern unsigned char lcd_framebuffer[LCD_HEIGHT/YBLOCK][LCD_WIDTH];
55unsigned char lcd_framebuffer_copy[LCD_HEIGHT/YBLOCK][LCD_WIDTH];
48 56
49void lcd_update (void) 57void lcd_update (void)
50{ 58{
@@ -55,21 +63,21 @@ void lcd_update (void)
55 int cp=0; 63 int cp=0;
56 struct coordinate clearpoints[LCD_WIDTH * LCD_HEIGHT]; 64 struct coordinate clearpoints[LCD_WIDTH * LCD_HEIGHT];
57 65
58 for(y=0; y<LCD_HEIGHT; y+=8) { 66 for(y=0; y<LCD_HEIGHT; y+=YBLOCK) {
59 for(x=0; x<LCD_WIDTH; x++) { 67 for(x=0; x<LCD_WIDTH; x++) {
60 if(lcd_framebuffer[y/8][x] || lcd_framebuffer_copy[y/8][x]) { 68 if(lcd_framebuffer[y/YBLOCK][x] || lcd_framebuffer_copy[y/YBLOCK][x]) {
61 /* one or more bits/pixels are changed */ 69 /* one or more bits/pixels are changed */
62 unsigned char diff = 70 unsigned char diff =
63 lcd_framebuffer[y/8][x] ^ lcd_framebuffer_copy[y/8][x]; 71 lcd_framebuffer[y/YBLOCK][x] ^ lcd_framebuffer_copy[y/YBLOCK][x];
64 72
65 for(bit=0; bit<8; bit++) { 73 for(bit=0; bit<YBLOCK; bit++) {
66 if(lcd_framebuffer[y/8][x]&(1<<bit)) { 74 if(lcd_framebuffer[y/YBLOCK][x]&(1<<(bit*LCD_DEPTH+BITOFFS))) {
67 /* set a dot */ 75 /* set a dot */
68 points[p].x = x + MARGIN_X; 76 points[p].x = x + MARGIN_X;
69 points[p].y = y+bit + MARGIN_Y; 77 points[p].y = y+bit + MARGIN_Y;
70 p++; /* increase the point counter */ 78 p++; /* increase the point counter */
71 } 79 }
72 else if(diff &(1<<bit)) { 80 else if(diff &(1<<(bit*LCD_DEPTH+BITOFFS))) {
73 /* clear a dot */ 81 /* clear a dot */
74 clearpoints[cp].x = x + MARGIN_X; 82 clearpoints[cp].x = x + MARGIN_X;
75 clearpoints[cp].y = y+bit + MARGIN_Y; 83 clearpoints[cp].y = y+bit + MARGIN_Y;
@@ -110,33 +118,33 @@ void lcd_update_rect(int x_start, int y_start,
110 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n", 118 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n",
111 counter++, x_start, y_start, width, height); 119 counter++, x_start, y_start, width, height);
112#endif 120#endif
113 /* The Y coordinates have to work on even 8 pixel rows */ 121 /* The Y coordinates have to work on even YBLOCK pixel rows */
114 ymax = (yline + height)/8; 122 ymax = (yline + height)/YBLOCK;
115 yline /= 8; 123 yline /= YBLOCK;
116 124
117 xmax = x_start + width; 125 xmax = x_start + width;
118 126
119 if(xmax > LCD_WIDTH) 127 if(xmax > LCD_WIDTH)
120 xmax = LCD_WIDTH; 128 xmax = LCD_WIDTH;
121 if(ymax >= LCD_HEIGHT/8) 129 if(ymax >= LCD_HEIGHT/YBLOCK)
122 ymax = LCD_HEIGHT/8-1; 130 ymax = LCD_HEIGHT/YBLOCK-1;
123 131
124 for(; yline<=ymax; yline++) { 132 for(; yline<=ymax; yline++) {
125 y = yline * 8; 133 y = yline * YBLOCK;
126 for(x=x_start; x<xmax; x++) { 134 for(x=x_start; x<xmax; x++) {
127 if(lcd_framebuffer[yline][x] || lcd_framebuffer_copy[yline][x]) { 135 if(lcd_framebuffer[yline][x] || lcd_framebuffer_copy[yline][x]) {
128 /* one or more bits/pixels are changed */ 136 /* one or more bits/pixels are changed */
129 unsigned char diff = 137 unsigned char diff =
130 lcd_framebuffer[yline][x] ^ lcd_framebuffer_copy[yline][x]; 138 lcd_framebuffer[yline][x] ^ lcd_framebuffer_copy[yline][x];
131 139
132 for(bit=0; bit<8; bit++) { 140 for(bit=0; bit<YBLOCK; bit++) {
133 if(lcd_framebuffer[yline][x]&(1<<bit)) { 141 if(lcd_framebuffer[yline][x]&(1<<(bit*LCD_DEPTH+BITOFFS))) {
134 /* set a dot */ 142 /* set a dot */
135 points[p].x = x + MARGIN_X; 143 points[p].x = x + MARGIN_X;
136 points[p].y = y+bit + MARGIN_Y; 144 points[p].y = y+bit + MARGIN_Y;
137 p++; /* increase the point counter */ 145 p++; /* increase the point counter */
138 } 146 }
139 else if(diff &(1<<bit)) { 147 else if(diff &(1<<(bit*LCD_DEPTH+BITOFFS))) {
140 /* clear a dot */ 148 /* clear a dot */
141 clearpoints[cp].x = x + MARGIN_X; 149 clearpoints[cp].x = x + MARGIN_X;
142 clearpoints[cp].y = y+bit + MARGIN_Y; 150 clearpoints[cp].y = y+bit + MARGIN_Y;