Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2002 by Alan Korr |
| 11 | * |
| 12 | * All files in this archive are subject to the GNU General Public License. |
| 13 | * See the file COPYING in the source tree root for full license agreement. |
| 14 | * |
| 15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 16 | * KIND, either express or implied. |
| 17 | * |
| 18 | ****************************************************************************/ |
| 19 | #include "config.h" |
| 20 | |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 21 | #include "lcd.h" |
| 22 | #include "kernel.h" |
| 23 | #include "thread.h" |
| 24 | #include <string.h> |
| 25 | #include <stdlib.h> |
| 26 | #include "file.h" |
| 27 | #include "debug.h" |
| 28 | #include "system.h" |
| 29 | #include "font.h" |
Björn Stenberg | 067262d | 2003-07-09 23:07:49 +0000 | [diff] [blame] | 30 | #include "hwcompat.h" |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 31 | #include "rbunicode.h" |
Linus Nielsen Feltzing | 41a53d2 | 2005-08-08 19:23:28 +0000 | [diff] [blame] | 32 | #include "bidi.h" |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 33 | |
| 34 | /*** definitions ***/ |
| 35 | |
| 36 | #define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00) |
| 37 | #define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10) |
| 38 | #define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20) |
| 39 | #define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28) |
| 40 | #define LCD_SET_DISPLAY_START_LINE ((char)0x40) |
| 41 | #define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81) |
| 42 | #define LCD_SET_SEGMENT_REMAP ((char)0xA0) |
| 43 | #define LCD_SET_LCD_BIAS ((char)0xA2) |
| 44 | #define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4) |
| 45 | #define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5) |
| 46 | #define LCD_SET_NORMAL_DISPLAY ((char)0xA6) |
| 47 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) |
Jörg Hohensohn | d3fba46 | 2003-06-26 06:49:34 +0000 | [diff] [blame] | 48 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) |
| 49 | #define LCD_SET_BIAS_TC_OSC ((char)0xA9) |
| 50 | #define LCD_SET_1OVER4_BIAS_RATIO ((char)0xAA) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 51 | #define LCD_SET_INDICATOR_OFF ((char)0xAC) |
| 52 | #define LCD_SET_INDICATOR_ON ((char)0xAD) |
| 53 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) |
| 54 | #define LCD_SET_DISPLAY_ON ((char)0xAF) |
| 55 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) |
| 56 | #define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0) |
Jörg Hohensohn | d3fba46 | 2003-06-26 06:49:34 +0000 | [diff] [blame] | 57 | #define LCD_SET_TOTAL_FRAME_PHASES ((char)0xD2) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 58 | #define LCD_SET_DISPLAY_OFFSET ((char)0xD3) |
| 59 | #define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0) |
| 60 | #define LCD_SOFTWARE_RESET ((char)0xE2) |
| 61 | #define LCD_NOP ((char)0xE3) |
| 62 | #define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE) |
| 63 | |
| 64 | /* LCD command codes */ |
Björn Stenberg | df194b0 | 2003-02-23 19:02:31 +0000 | [diff] [blame] | 65 | #define LCD_CNTL_RESET 0xe2 /* Software reset */ |
| 66 | #define LCD_CNTL_POWER 0x2f /* Power control */ |
| 67 | #define LCD_CNTL_CONTRAST 0x81 /* Contrast */ |
| 68 | #define LCD_CNTL_OUTSCAN 0xc8 /* Output scan direction */ |
| 69 | #define LCD_CNTL_SEGREMAP 0xa1 /* Segment remap */ |
| 70 | #define LCD_CNTL_DISPON 0xaf /* Display on */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 71 | |
Björn Stenberg | df194b0 | 2003-02-23 19:02:31 +0000 | [diff] [blame] | 72 | #define LCD_CNTL_PAGE 0xb0 /* Page address */ |
| 73 | #define LCD_CNTL_HIGHCOL 0x10 /* Upper column address */ |
| 74 | #define LCD_CNTL_LOWCOL 0x00 /* Lower column address */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 75 | |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 76 | #define SCROLLABLE_LINES 13 |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 77 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 78 | /*** globals ***/ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 79 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 80 | unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; |
| 81 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 82 | static int drawmode = DRMODE_SOLID; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 83 | static int xmargin = 0; |
| 84 | static int ymargin = 0; |
| 85 | static int curfont = FONT_SYSFIXED; |
| 86 | #ifndef SIMULATOR |
| 87 | static int xoffset; /* needed for flip */ |
| 88 | #endif |
| 89 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 90 | /* scrolling */ |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 91 | static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 92 | static void scroll_thread(void); |
| 93 | static char scroll_stack[DEFAULT_STACK_SIZE]; |
Jens Arnold | 2b0694c | 2004-08-03 05:58:46 +0000 | [diff] [blame] | 94 | static const char scroll_name[] = "scroll"; |
Jens Arnold | 05af280 | 2005-07-28 08:36:24 +0000 | [diff] [blame] | 95 | static int scroll_ticks = 12; /* # of ticks between updates*/ |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 96 | static int scroll_delay = HZ/2; /* ticks delay before start */ |
Jens Arnold | 05af280 | 2005-07-28 08:36:24 +0000 | [diff] [blame] | 97 | static int scroll_step = 6; /* pixels per scroll step */ |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 98 | static int bidir_limit = 50; /* percent */ |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 99 | static struct scrollinfo scroll[SCROLLABLE_LINES]; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 100 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 101 | static const char scroll_tick_table[16] = { |
| 102 | /* Hz values: |
| 103 | 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */ |
| 104 | 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3 |
| 105 | }; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 106 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 107 | /*** driver routines ***/ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 108 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 109 | /* optimised archos recorder code is in lcd.S */ |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 110 | |
| 111 | #if CONFIG_CPU == TCC730 |
| 112 | /* Optimization opportunity: |
| 113 | In the following I do exactly as in the archos firmware. |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 114 | There is probably a better way (ie. do only one mask operation) |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 115 | */ |
| 116 | void lcd_write_command(int cmd) { |
Jean-Philippe Bernardy | e386d94 | 2005-01-20 22:44:35 +0000 | [diff] [blame] | 117 | P2 &= 0xF7; |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 118 | P2 &= 0xDF; |
| 119 | P2 &= 0xFB; |
Jean-Philippe Bernardy | e386d94 | 2005-01-20 22:44:35 +0000 | [diff] [blame] | 120 | P0 = cmd; |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 121 | P2 |= 0x04; |
| 122 | P2 |= 0x08; |
| 123 | P2 |= 0x20; |
Jean-Philippe Bernardy | e386d94 | 2005-01-20 22:44:35 +0000 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | void lcd_write_data( const unsigned char* data, int count ) { |
| 127 | int i; |
| 128 | for (i=0; i < count; i++) { |
| 129 | P2 |= 0x08; |
| 130 | P2 &= 0xDF; |
| 131 | P2 &= 0xFB; |
| 132 | P0 = data[i]; |
| 133 | P2 |= 0x04; |
| 134 | P2 |= 0x08; |
| 135 | P2 |= 0x20; |
| 136 | } |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 137 | } |
| 138 | #endif |
| 139 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 140 | /*** hardware configuration ***/ |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 141 | |
Björn Stenberg | 067262d | 2003-07-09 23:07:49 +0000 | [diff] [blame] | 142 | int lcd_default_contrast(void) |
| 143 | { |
| 144 | #ifdef SIMULATOR |
| 145 | return 30; |
Daniel Stenberg | 9c394a3 | 2005-01-27 15:33:49 +0000 | [diff] [blame] | 146 | #elif CONFIG_LCD == LCD_GMINI100 |
Jean-Philippe Bernardy | 0d72de9 | 2005-01-27 14:14:21 +0000 | [diff] [blame] | 147 | return 31; |
Björn Stenberg | 067262d | 2003-07-09 23:07:49 +0000 | [diff] [blame] | 148 | #else |
| 149 | return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; |
| 150 | #endif |
| 151 | } |
| 152 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 153 | #ifndef SIMULATOR |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 154 | |
| 155 | void lcd_set_contrast(int val) |
| 156 | { |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 157 | lcd_write_command(LCD_CNTL_CONTRAST); |
| 158 | lcd_write_command(val); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Björn Stenberg | b107920 | 2003-02-27 14:22:30 +0000 | [diff] [blame] | 161 | void lcd_set_invert_display(bool yesno) |
| 162 | { |
| 163 | if (yesno) |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 164 | lcd_write_command(LCD_SET_REVERSE_DISPLAY); |
Björn Stenberg | b107920 | 2003-02-27 14:22:30 +0000 | [diff] [blame] | 165 | else |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 166 | lcd_write_command(LCD_SET_NORMAL_DISPLAY); |
Björn Stenberg | b107920 | 2003-02-27 14:22:30 +0000 | [diff] [blame] | 167 | } |
| 168 | |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 169 | /* turn the display upside down (call lcd_update() afterwards) */ |
| 170 | void lcd_set_flip(bool yesno) |
| 171 | { |
Jörg Hohensohn | d5c293a | 2004-09-09 06:12:40 +0000 | [diff] [blame] | 172 | #ifdef HAVE_DISPLAY_FLIPPED |
| 173 | if (!yesno) |
| 174 | #else |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 175 | if (yesno) |
Jörg Hohensohn | d5c293a | 2004-09-09 06:12:40 +0000 | [diff] [blame] | 176 | #endif |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 177 | #if CONFIG_LCD == LCD_GMINI100 |
Jean-Philippe Bernardy | e386d94 | 2005-01-20 22:44:35 +0000 | [diff] [blame] | 178 | { |
| 179 | lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01); |
| 180 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); |
| 181 | xoffset = 132 - LCD_WIDTH; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 182 | } |
| 183 | else |
| 184 | { |
Jean-Philippe Bernardy | e386d94 | 2005-01-20 22:44:35 +0000 | [diff] [blame] | 185 | lcd_write_command(LCD_SET_SEGMENT_REMAP); |
| 186 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); |
| 187 | xoffset = 0; |
| 188 | } |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 189 | #else |
| 190 | |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 191 | { |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 192 | lcd_write_command(LCD_SET_SEGMENT_REMAP); |
| 193 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION); |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 194 | xoffset = 132 - LCD_WIDTH; /* 132 colums minus the 112 we have */ |
| 195 | } |
| 196 | else |
| 197 | { |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 198 | lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01); |
| 199 | lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 200 | xoffset = 0; |
| 201 | } |
Jean-Philippe Bernardy | cacc37d | 2005-01-20 22:13:41 +0000 | [diff] [blame] | 202 | #endif |
Jörg Hohensohn | 56271b5 | 2003-12-12 22:11:08 +0000 | [diff] [blame] | 203 | } |
| 204 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 205 | /* Rolls up the lcd display by the specified amount of lines. |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 206 | * Lines that are rolled out over the top of the screen are |
| 207 | * rolled in from the bottom again. This is a hardware |
| 208 | * remapping only and all operations on the lcd are affected. |
| 209 | * -> |
| 210 | * @param int lines - The number of lines that are rolled. |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 211 | * The value must be 0 <= pixels < LCD_HEIGHT. */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 212 | void lcd_roll(int lines) |
| 213 | { |
Jens Arnold | 38e8a11 | 2004-04-21 09:39:29 +0000 | [diff] [blame] | 214 | lcd_write_command(LCD_SET_DISPLAY_START_LINE | (lines & (LCD_HEIGHT-1))); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 215 | } |
| 216 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 217 | #endif /* !SIMULATOR */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 218 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 219 | /* LCD init */ |
| 220 | #ifdef SIMULATOR |
| 221 | |
| 222 | void lcd_init(void) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 223 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 224 | create_thread(scroll_thread, scroll_stack, |
| 225 | sizeof(scroll_stack), scroll_name); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 226 | } |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 227 | #else |
| 228 | |
| 229 | void lcd_init(void) |
| 230 | { |
| 231 | #if CONFIG_CPU == TCC730 |
| 232 | /* Initialise P0 & some P2 output pins: |
| 233 | P0 -> all pins normal cmos output |
| 234 | P2 -> pins 1 to 5 normal cmos output. */ |
| 235 | P0CON = 0xff; |
| 236 | P2CONL |= 0x5a; |
| 237 | P2CONL &= 0x5b; |
| 238 | P2CONH |= 1; |
| 239 | #else |
| 240 | /* Initialize PB0-3 as output pins */ |
| 241 | PBCR2 &= 0xff00; /* MD = 00 */ |
| 242 | PBIOR |= 0x000f; /* IOR = 1 */ |
| 243 | #endif |
| 244 | |
| 245 | /* inits like the original firmware */ |
| 246 | lcd_write_command(LCD_SOFTWARE_RESET); |
| 247 | lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); |
| 248 | lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ |
| 249 | lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7); |
| 250 | /* power control register: op-amp=1, regulator=1, booster=1 */ |
| 251 | lcd_write_command(LCD_SET_DISPLAY_ON); |
| 252 | lcd_write_command(LCD_SET_NORMAL_DISPLAY); |
| 253 | lcd_set_flip(false); |
| 254 | lcd_write_command(LCD_SET_DISPLAY_START_LINE + 0); |
| 255 | lcd_set_contrast(lcd_default_contrast()); |
| 256 | lcd_write_command(LCD_SET_PAGE_ADDRESS); |
| 257 | lcd_write_command(LCD_SET_LOWER_COLUMN_ADDRESS + 0); |
| 258 | lcd_write_command(LCD_SET_HIGHER_COLUMN_ADDRESS + 0); |
| 259 | |
| 260 | lcd_clear_display(); |
| 261 | lcd_update(); |
| 262 | |
| 263 | create_thread(scroll_thread, scroll_stack, |
| 264 | sizeof(scroll_stack), scroll_name); |
| 265 | } |
| 266 | |
| 267 | /*** Update functions ***/ |
| 268 | |
| 269 | /* Performance function that works with an external buffer |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 270 | note that by and bheight are in 8-pixel units! */ |
| 271 | void lcd_blit(const unsigned char* data, int x, int by, int width, |
| 272 | int bheight, int stride) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 273 | { |
| 274 | /* Copy display bitmap to hardware */ |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 275 | while (bheight--) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 276 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 277 | lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf)); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 278 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf)); |
| 279 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf)); |
| 280 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 281 | lcd_write_data(data, width); |
| 282 | data += stride; |
| 283 | } |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | |
| 287 | /* Update the display. |
| 288 | This must be called after all other LCD functions that change the display. */ |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 289 | void lcd_update(void) ICODE_ATTR; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 290 | void lcd_update(void) |
| 291 | { |
| 292 | int y; |
| 293 | |
| 294 | /* Copy display bitmap to hardware */ |
| 295 | for (y = 0; y < LCD_HEIGHT/8; y++) |
| 296 | { |
| 297 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
Jens Arnold | ce19ce0 | 2005-06-29 01:54:21 +0000 | [diff] [blame] | 298 | lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf)); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 299 | lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf)); |
| 300 | |
| 301 | lcd_write_data (lcd_framebuffer[y], LCD_WIDTH); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | /* Update a fraction of the display. */ |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 306 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 307 | void lcd_update_rect(int x, int y, int width, int height) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 308 | { |
| 309 | int ymax; |
| 310 | |
| 311 | /* The Y coordinates have to work on even 8 pixel rows */ |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 312 | ymax = (y + height-1) >> 3; |
| 313 | y >>= 3; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 314 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 315 | if(x + width > LCD_WIDTH) |
| 316 | width = LCD_WIDTH - x; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 317 | if (width <= 0) |
| 318 | return; /* nothing left to do, 0 is harmful to lcd_write_data() */ |
| 319 | if(ymax >= LCD_HEIGHT/8) |
| 320 | ymax = LCD_HEIGHT/8-1; |
| 321 | |
| 322 | /* Copy specified rectange bitmap to hardware */ |
| 323 | for (; y <= ymax; y++) |
| 324 | { |
| 325 | lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); |
Jens Arnold | ce19ce0 | 2005-06-29 01:54:21 +0000 | [diff] [blame] | 326 | lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf)); |
| 327 | lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf)); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 328 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 329 | lcd_write_data (&lcd_framebuffer[y][x], width); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 330 | } |
| 331 | } |
| 332 | #endif /* !SIMULATOR */ |
| 333 | |
| 334 | /*** parameter handling ***/ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 335 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 336 | void lcd_set_drawmode(int mode) |
| 337 | { |
| 338 | drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID); |
| 339 | } |
| 340 | |
| 341 | int lcd_get_drawmode(void) |
| 342 | { |
| 343 | return drawmode; |
| 344 | } |
| 345 | |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 346 | void lcd_setmargins(int x, int y) |
| 347 | { |
| 348 | xmargin = x; |
| 349 | ymargin = y; |
| 350 | } |
| 351 | |
| 352 | int lcd_getxmargin(void) |
| 353 | { |
| 354 | return xmargin; |
| 355 | } |
| 356 | |
| 357 | int lcd_getymargin(void) |
| 358 | { |
| 359 | return ymargin; |
| 360 | } |
| 361 | |
| 362 | void lcd_setfont(int newfont) |
| 363 | { |
| 364 | curfont = newfont; |
| 365 | } |
| 366 | |
Jens Arnold | abe77a1 | 2004-08-01 21:50:57 +0000 | [diff] [blame] | 367 | int lcd_getstringsize(const unsigned char *str, int *w, int *h) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 368 | { |
Christian Gmeiner | c3d0a22 | 2005-04-19 12:50:02 +0000 | [diff] [blame] | 369 | return font_getstringsize(str, w, h, curfont); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 370 | } |
| 371 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 372 | /*** low-level drawing functions ***/ |
| 373 | |
| 374 | static void setpixel(int x, int y) |
| 375 | { |
Jens Arnold | b5fc253 | 2005-07-08 19:09:17 +0000 | [diff] [blame] | 376 | lcd_framebuffer[y>>3][x] |= 1 << (y & 7); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | static void clearpixel(int x, int y) |
| 380 | { |
Jens Arnold | b5fc253 | 2005-07-08 19:09:17 +0000 | [diff] [blame] | 381 | lcd_framebuffer[y>>3][x] &= ~(1 << (y & 7)); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | static void flippixel(int x, int y) |
| 385 | { |
Jens Arnold | b5fc253 | 2005-07-08 19:09:17 +0000 | [diff] [blame] | 386 | lcd_framebuffer[y>>3][x] ^= 1 << (y & 7); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | static void nopixel(int x, int y) |
| 390 | { |
| 391 | (void)x; |
| 392 | (void)y; |
| 393 | } |
| 394 | |
Jens Arnold | 71bc504 | 2005-11-06 23:49:29 +0000 | [diff] [blame] | 395 | lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 396 | flippixel, nopixel, setpixel, setpixel, |
| 397 | nopixel, clearpixel, nopixel, clearpixel |
| 398 | }; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 399 | |
| 400 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 401 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 402 | static void flipblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 403 | { |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 404 | *address ^= bits & mask; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 408 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 409 | static void bgblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 410 | { |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 411 | *address &= bits | ~mask; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 415 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 416 | static void fgblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 417 | { |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 418 | *address |= bits & mask; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 422 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 423 | static void solidblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 424 | { |
| 425 | *address = (*address & ~mask) | (bits & mask); |
| 426 | } |
| 427 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 428 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 429 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 430 | static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 431 | { |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 432 | *address ^= ~bits & mask; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 436 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 437 | static void bginvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 438 | { |
| 439 | *address &= ~(bits & mask); |
| 440 | } |
| 441 | |
| 442 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 443 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 444 | static void fginvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 445 | { |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 446 | *address |= ~bits & mask; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 450 | ICODE_ATTR; |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 451 | static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 452 | { |
| 453 | *address = (*address & ~mask) | (~bits & mask); |
| 454 | } |
| 455 | |
Jens Arnold | 71bc504 | 2005-11-06 23:49:29 +0000 | [diff] [blame] | 456 | lcd_blockfunc_type* const lcd_blockfuncs[8] = { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 457 | flipblock, bgblock, fgblock, solidblock, |
| 458 | flipinvblock, bginvblock, fginvblock, solidinvblock |
| 459 | }; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 460 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 461 | /*** drawing functions ***/ |
| 462 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 463 | /* Clear the whole display */ |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 464 | void lcd_clear_display(void) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 465 | { |
Jens Arnold | 9349412 | 2005-06-25 00:28:09 +0000 | [diff] [blame] | 466 | unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0; |
| 467 | |
| 468 | memset(lcd_framebuffer, bits, sizeof lcd_framebuffer); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 469 | scrolling_lines = 0; |
Linus Nielsen Feltzing | e43b78a | 2003-04-16 00:12:31 +0000 | [diff] [blame] | 470 | } |
| 471 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 472 | /* Set a single pixel */ |
| 473 | void lcd_drawpixel(int x, int y) |
Linus Nielsen Feltzing | e43b78a | 2003-04-16 00:12:31 +0000 | [diff] [blame] | 474 | { |
Jens Arnold | 7f8cc3f | 2005-06-29 21:33:36 +0000 | [diff] [blame] | 475 | if (((unsigned)x < LCD_WIDTH) && ((unsigned)y < LCD_HEIGHT)) |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 476 | lcd_pixelfuncs[drawmode](x, y); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 477 | } |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 478 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 479 | /* Draw a line */ |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 480 | void lcd_drawline(int x1, int y1, int x2, int y2) |
| 481 | { |
| 482 | int numpixels; |
| 483 | int i; |
| 484 | int deltax, deltay; |
| 485 | int d, dinc1, dinc2; |
| 486 | int x, xinc1, xinc2; |
| 487 | int y, yinc1, yinc2; |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 488 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[drawmode]; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 489 | |
| 490 | deltax = abs(x2 - x1); |
| 491 | deltay = abs(y2 - y1); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 492 | xinc2 = 1; |
| 493 | yinc2 = 1; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 494 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 495 | if (deltax >= deltay) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 496 | { |
| 497 | numpixels = deltax; |
| 498 | d = 2 * deltay - deltax; |
| 499 | dinc1 = deltay * 2; |
| 500 | dinc2 = (deltay - deltax) * 2; |
| 501 | xinc1 = 1; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 502 | yinc1 = 0; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 503 | } |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 504 | else |
| 505 | { |
| 506 | numpixels = deltay; |
| 507 | d = 2 * deltax - deltay; |
| 508 | dinc1 = deltax * 2; |
| 509 | dinc2 = (deltax - deltay) * 2; |
| 510 | xinc1 = 0; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 511 | yinc1 = 1; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 512 | } |
| 513 | numpixels++; /* include endpoints */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 514 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 515 | if (x1 > x2) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 516 | { |
| 517 | xinc1 = -xinc1; |
| 518 | xinc2 = -xinc2; |
| 519 | } |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 520 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 521 | if (y1 > y2) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 522 | { |
| 523 | yinc1 = -yinc1; |
| 524 | yinc2 = -yinc2; |
| 525 | } |
| 526 | |
| 527 | x = x1; |
| 528 | y = y1; |
| 529 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 530 | for (i = 0; i < numpixels; i++) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 531 | { |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 532 | if (((unsigned)x < LCD_WIDTH) && ((unsigned)y < LCD_HEIGHT)) |
| 533 | pfunc(x, y); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 534 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 535 | if (d < 0) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 536 | { |
| 537 | d += dinc1; |
| 538 | x += xinc1; |
| 539 | y += yinc1; |
| 540 | } |
| 541 | else |
| 542 | { |
| 543 | d += dinc2; |
| 544 | x += xinc2; |
| 545 | y += yinc2; |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 550 | /* Draw a horizontal line (optimised) */ |
| 551 | void lcd_hline(int x1, int x2, int y) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 552 | { |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 553 | int x; |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 554 | unsigned char *dst, *dst_end; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 555 | unsigned mask; |
Jens Arnold | 24a1f94 | 2005-06-24 23:06:06 +0000 | [diff] [blame] | 556 | lcd_blockfunc_type *bfunc; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 557 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 558 | /* direction flip */ |
| 559 | if (x2 < x1) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 560 | { |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 561 | x = x1; |
| 562 | x1 = x2; |
| 563 | x2 = x; |
| 564 | } |
| 565 | |
| 566 | /* nothing to draw? */ |
| 567 | if (((unsigned)y >= LCD_HEIGHT) || (x1 >= LCD_WIDTH) || (x2 < 0)) |
| 568 | return; |
| 569 | |
| 570 | /* clipping */ |
| 571 | if (x1 < 0) |
| 572 | x1 = 0; |
| 573 | if (x2 >= LCD_WIDTH) |
| 574 | x2 = LCD_WIDTH-1; |
| 575 | |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 576 | bfunc = lcd_blockfuncs[drawmode]; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 577 | dst = &lcd_framebuffer[y>>3][x1]; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 578 | mask = 1 << (y & 7); |
| 579 | |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 580 | dst_end = dst + x2 - x1; |
| 581 | do |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 582 | bfunc(dst++, mask, 0xFFu); |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 583 | while (dst <= dst_end); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | /* Draw a vertical line (optimised) */ |
| 587 | void lcd_vline(int x, int y1, int y2) |
| 588 | { |
| 589 | int ny; |
| 590 | unsigned char *dst; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 591 | unsigned mask, mask_bottom; |
Jens Arnold | 24a1f94 | 2005-06-24 23:06:06 +0000 | [diff] [blame] | 592 | lcd_blockfunc_type *bfunc; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 593 | |
| 594 | /* direction flip */ |
| 595 | if (y2 < y1) |
| 596 | { |
| 597 | ny = y1; |
| 598 | y1 = y2; |
| 599 | y2 = ny; |
| 600 | } |
| 601 | |
| 602 | /* nothing to draw? */ |
| 603 | if (((unsigned)x >= LCD_WIDTH) || (y1 >= LCD_HEIGHT) || (y2 < 0)) |
| 604 | return; |
| 605 | |
| 606 | /* clipping */ |
| 607 | if (y1 < 0) |
| 608 | y1 = 0; |
| 609 | if (y2 >= LCD_HEIGHT) |
| 610 | y2 = LCD_HEIGHT-1; |
| 611 | |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 612 | bfunc = lcd_blockfuncs[drawmode]; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 613 | dst = &lcd_framebuffer[y1>>3][x]; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 614 | ny = y2 - (y1 & ~7); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 615 | mask = 0xFFu << (y1 & 7); |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 616 | mask_bottom = 0xFFu >> (~ny & 7); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 617 | |
| 618 | for (; ny >= 8; ny -= 8) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 619 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 620 | bfunc(dst, mask, 0xFFu); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 621 | dst += LCD_WIDTH; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 622 | mask = 0xFFu; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 623 | } |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 624 | mask &= mask_bottom; |
| 625 | bfunc(dst, mask, 0xFFu); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | /* Draw a rectangular box */ |
| 629 | void lcd_drawrect(int x, int y, int width, int height) |
| 630 | { |
| 631 | if ((width <= 0) || (height <= 0)) |
| 632 | return; |
| 633 | |
| 634 | int x2 = x + width - 1; |
| 635 | int y2 = y + height - 1; |
| 636 | |
| 637 | lcd_vline(x, y, y2); |
| 638 | lcd_vline(x2, y, y2); |
| 639 | lcd_hline(x, x2, y); |
| 640 | lcd_hline(x, x2, y2); |
| 641 | } |
| 642 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 643 | /* Fill a rectangular area */ |
| 644 | void lcd_fillrect(int x, int y, int width, int height) |
| 645 | { |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 646 | int ny; |
| 647 | unsigned char *dst, *dst_end; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 648 | unsigned mask, mask_bottom; |
| 649 | unsigned bits = 0xFFu; |
Jens Arnold | 24a1f94 | 2005-06-24 23:06:06 +0000 | [diff] [blame] | 650 | lcd_blockfunc_type *bfunc; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 651 | bool fillopt; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 652 | |
| 653 | /* nothing to draw? */ |
| 654 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 655 | || (x + width <= 0) || (y + height <= 0)) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 656 | return; |
| 657 | |
| 658 | /* clipping */ |
| 659 | if (x < 0) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 660 | { |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 661 | width += x; |
| 662 | x = 0; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 663 | } |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 664 | if (y < 0) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 665 | { |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 666 | height += y; |
| 667 | y = 0; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 668 | } |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 669 | if (x + width > LCD_WIDTH) |
| 670 | width = LCD_WIDTH - x; |
| 671 | if (y + height > LCD_HEIGHT) |
| 672 | height = LCD_HEIGHT - y; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 673 | |
| 674 | fillopt = (drawmode & DRMODE_INVERSEVID) ? |
| 675 | (drawmode & DRMODE_BG) : (drawmode & DRMODE_FG); |
| 676 | if (fillopt &&(drawmode & DRMODE_INVERSEVID)) |
| 677 | bits = 0; |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 678 | bfunc = lcd_blockfuncs[drawmode]; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 679 | dst = &lcd_framebuffer[y>>3][x]; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 680 | ny = height - 1 + (y & 7); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 681 | mask = 0xFFu << (y & 7); |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 682 | mask_bottom = 0xFFu >> (~ny & 7); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 683 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 684 | for (; ny >= 8; ny -= 8) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 685 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 686 | if (fillopt && (mask == 0xFFu)) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 687 | memset(dst, bits, width); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 688 | else |
| 689 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 690 | unsigned char *dst_row = dst; |
| 691 | |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 692 | dst_end = dst_row + width; |
| 693 | do |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 694 | bfunc(dst_row++, mask, 0xFFu); |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 695 | while (dst_row < dst_end); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 696 | } |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 697 | |
| 698 | dst += LCD_WIDTH; |
| 699 | mask = 0xFFu; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 700 | } |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 701 | mask &= mask_bottom; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 702 | |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 703 | if (fillopt && (mask == 0xFFu)) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 704 | memset(dst, bits, width); |
| 705 | else |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 706 | { |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 707 | dst_end = dst + width; |
| 708 | do |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 709 | bfunc(dst++, mask, 0xFFu); |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 710 | while (dst < dst_end); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 711 | } |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | /* About Rockbox' internal bitmap format: |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 715 | * |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 716 | * A bitmap contains one bit for every pixel that defines if that pixel is |
| 717 | * black (1) or white (0). Bits within a byte are arranged vertically, LSB |
| 718 | * at top. |
| 719 | * The bytes are stored in row-major order, with byte 0 being top left, |
| 720 | * byte 1 2nd from left etc. The first row of bytes defines pixel rows |
| 721 | * 0..7, the second row defines pixel row 8..15 etc. |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 722 | * |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 723 | * This is the same as the internal lcd hw format. */ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 724 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 725 | /* Draw a partial bitmap */ |
| 726 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, |
| 727 | int stride, int x, int y, int width, int height) |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 728 | ICODE_ATTR; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 729 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, |
| 730 | int stride, int x, int y, int width, int height) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 731 | { |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 732 | int shift, ny; |
| 733 | unsigned char *dst, *dst_end; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 734 | unsigned mask, mask_bottom; |
| 735 | lcd_blockfunc_type *bfunc; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 736 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 737 | /* nothing to draw? */ |
| 738 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
| 739 | || (x + width <= 0) || (y + height <= 0)) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 740 | return; |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 741 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 742 | /* clipping */ |
| 743 | if (x < 0) |
Jörg Hohensohn | 5040cc5 | 2003-12-23 23:41:45 +0000 | [diff] [blame] | 744 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 745 | width += x; |
| 746 | src_x -= x; |
| 747 | x = 0; |
| 748 | } |
| 749 | if (y < 0) |
| 750 | { |
| 751 | height += y; |
| 752 | src_y -= y; |
| 753 | y = 0; |
| 754 | } |
| 755 | if (x + width > LCD_WIDTH) |
| 756 | width = LCD_WIDTH - x; |
| 757 | if (y + height > LCD_HEIGHT) |
| 758 | height = LCD_HEIGHT - y; |
| 759 | |
| 760 | src += stride * (src_y >> 3) + src_x; /* move starting point */ |
| 761 | src_y &= 7; |
| 762 | y -= src_y; |
| 763 | dst = &lcd_framebuffer[y>>3][x]; |
| 764 | shift = y & 7; |
| 765 | ny = height - 1 + shift + src_y; |
| 766 | |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 767 | bfunc = lcd_blockfuncs[drawmode]; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 768 | mask = 0xFFu << (shift + src_y); |
Jens Arnold | f89f011 | 2005-07-04 06:20:50 +0000 | [diff] [blame] | 769 | mask_bottom = 0xFFu >> (~ny & 7); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 770 | |
| 771 | if (shift == 0) |
| 772 | { |
| 773 | bool copyopt = (drawmode == DRMODE_SOLID); |
| 774 | |
| 775 | for (; ny >= 8; ny -= 8) |
Jens Arnold | 6dc88dc | 2004-05-14 23:08:08 +0000 | [diff] [blame] | 776 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 777 | if (copyopt && (mask == 0xFFu)) |
| 778 | memcpy(dst, src, width); |
| 779 | else |
| 780 | { |
| 781 | const unsigned char *src_row = src; |
| 782 | unsigned char *dst_row = dst; |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 783 | |
| 784 | dst_end = dst_row + width; |
| 785 | do |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 786 | bfunc(dst_row++, mask, *src_row++); |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 787 | while (dst_row < dst_end); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 788 | } |
| 789 | |
Jens Arnold | 6dc88dc | 2004-05-14 23:08:08 +0000 | [diff] [blame] | 790 | src += stride; |
| 791 | dst += LCD_WIDTH; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 792 | mask = 0xFFu; |
Jens Arnold | 6dc88dc | 2004-05-14 23:08:08 +0000 | [diff] [blame] | 793 | } |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 794 | mask &= mask_bottom; |
Jörg Hohensohn | 5040cc5 | 2003-12-23 23:41:45 +0000 | [diff] [blame] | 795 | |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 796 | if (copyopt && (mask == 0xFFu)) |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 797 | memcpy(dst, src, width); |
| 798 | else |
| 799 | { |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 800 | dst_end = dst + width; |
| 801 | do |
Jens Arnold | a142d4d | 2005-06-30 18:42:24 +0000 | [diff] [blame] | 802 | bfunc(dst++, mask, *src++); |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 803 | while (dst < dst_end); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 804 | } |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 805 | } |
| 806 | else |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 807 | { |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 808 | dst_end = dst + width; |
| 809 | do |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 810 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 811 | const unsigned char *src_col = src++; |
| 812 | unsigned char *dst_col = dst++; |
| 813 | unsigned mask_col = mask; |
| 814 | unsigned data = 0; |
| 815 | |
| 816 | for (y = ny; y >= 8; y -= 8) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 817 | { |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 818 | data |= *src_col << shift; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 819 | |
| 820 | if (mask_col & 0xFFu) |
| 821 | { |
| 822 | bfunc(dst_col, mask_col, data); |
| 823 | mask_col = 0xFFu; |
| 824 | } |
| 825 | else |
| 826 | mask_col >>= 8; |
| 827 | |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 828 | src_col += stride; |
| 829 | dst_col += LCD_WIDTH; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 830 | data >>= 8; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 831 | } |
Jens Arnold | 2d446fe | 2004-05-14 22:55:05 +0000 | [diff] [blame] | 832 | data |= *src_col << shift; |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 833 | bfunc(dst_col, mask_col & mask_bottom, data); |
| 834 | } |
Jens Arnold | 3291ae6 | 2005-07-02 07:21:21 +0000 | [diff] [blame] | 835 | while (dst < dst_end); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 836 | } |
| 837 | } |
| 838 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 839 | /* Draw a full bitmap */ |
| 840 | void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height) |
| 841 | { |
| 842 | lcd_bitmap_part(src, 0, 0, width, x, y, width, height); |
| 843 | } |
| 844 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 845 | /* put a string at a given pixel position, skipping first ofs pixel columns */ |
| 846 | static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 847 | { |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 848 | unsigned short ch; |
| 849 | unsigned short *ucs; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 850 | struct font* pf = font_get(curfont); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 851 | |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 852 | ucs = bidi_l2v(str, 1); |
Linus Nielsen Feltzing | 41a53d2 | 2005-08-08 19:23:28 +0000 | [diff] [blame] | 853 | |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 854 | while ((ch = *ucs++) != 0 && x < LCD_WIDTH) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 855 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 856 | int width; |
| 857 | const unsigned char *bits; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 858 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 859 | /* check input range */ |
| 860 | if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) |
| 861 | ch = pf->defaultchar; |
| 862 | ch -= pf->firstchar; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 863 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 864 | /* get proportional width and glyph bits */ |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 865 | width = font_get_width(pf,ch); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 866 | |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 867 | if (ofs > width) |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 868 | { |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 869 | ofs -= width; |
| 870 | continue; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 871 | } |
| 872 | |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 873 | bits = font_get_bits(pf, ch); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 874 | |
Jens Arnold | f894a4c | 2005-07-06 22:58:02 +0000 | [diff] [blame] | 875 | lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 876 | |
| 877 | x += width - ofs; |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 878 | ofs = 0; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 879 | } |
| 880 | } |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 881 | /* put a string at a given pixel position */ |
| 882 | void lcd_putsxy(int x, int y, const unsigned char *str) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 883 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 884 | lcd_putsxyofs(x, y, 0, str); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 885 | } |
| 886 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 887 | /*** Line oriented text output ***/ |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 888 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 889 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 890 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 891 | int xpos,ypos,w,h; |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 892 | int lastmode = drawmode; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 893 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 894 | /* make sure scrolling is turned off on the line we are updating */ |
| 895 | scrolling_lines &= ~(1 << y); |
| 896 | |
| 897 | if(!str || !str[0]) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 898 | return; |
| 899 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 900 | lcd_getstringsize(str, &w, &h); |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 901 | xpos = xmargin + x*w / utf8length(str); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 902 | ypos = ymargin + y*h; |
| 903 | lcd_putsxy(xpos, ypos, str); |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 904 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 905 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 906 | if (style & STYLE_INVERT) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 907 | { |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 908 | drawmode = DRMODE_COMPLEMENT; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 909 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); |
| 910 | } |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 911 | drawmode = lastmode; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 912 | } |
| 913 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 914 | /* put a string at a given char position */ |
| 915 | void lcd_puts(int x, int y, const unsigned char *str) |
| 916 | { |
| 917 | lcd_puts_style(x, y, str, STYLE_DEFAULT); |
| 918 | } |
| 919 | |
| 920 | /*** scrolling ***/ |
| 921 | |
Hardeep Sidhu | 00acdfa | 2003-12-10 00:11:25 +0000 | [diff] [blame] | 922 | /* Reverse the invert setting of the scrolling line (if any) at given char |
| 923 | position. Setting will go into affect next time line scrolls. */ |
| 924 | void lcd_invertscroll(int x, int y) |
| 925 | { |
| 926 | struct scrollinfo* s; |
Hardeep Sidhu | 00acdfa | 2003-12-10 00:11:25 +0000 | [diff] [blame] | 927 | |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 928 | (void)x; |
Hardeep Sidhu | 00acdfa | 2003-12-10 00:11:25 +0000 | [diff] [blame] | 929 | |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 930 | s = &scroll[y]; |
| 931 | s->invert = !s->invert; |
Hardeep Sidhu | 00acdfa | 2003-12-10 00:11:25 +0000 | [diff] [blame] | 932 | } |
| 933 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 934 | void lcd_stop_scroll(void) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 935 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 936 | scrolling_lines=0; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 937 | } |
| 938 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 939 | void lcd_scroll_speed(int speed) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 940 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 941 | scroll_ticks = scroll_tick_table[speed]; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 942 | } |
| 943 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 944 | void lcd_scroll_step(int step) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 945 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 946 | scroll_step = step; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 947 | } |
| 948 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 949 | void lcd_scroll_delay(int ms) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 950 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 951 | scroll_delay = ms / (HZ / 10); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 952 | } |
| 953 | |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 954 | void lcd_bidir_scroll(int percent) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 955 | { |
Jens Arnold | 6a556c1 | 2005-06-23 16:53:54 +0000 | [diff] [blame] | 956 | bidir_limit = percent; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 957 | } |
| 958 | |
Jens Arnold | c76c568 | 2004-08-16 23:37:23 +0000 | [diff] [blame] | 959 | void lcd_puts_scroll(int x, int y, const unsigned char *string) |
Linus Nielsen Feltzing | e43b78a | 2003-04-16 00:12:31 +0000 | [diff] [blame] | 960 | { |
| 961 | lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT); |
| 962 | } |
| 963 | |
Jens Arnold | c76c568 | 2004-08-16 23:37:23 +0000 | [diff] [blame] | 964 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 965 | { |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 966 | struct scrollinfo* s; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 967 | int w, h; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 968 | |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 969 | s = &scroll[y]; |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 970 | |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 971 | s->start_tick = current_tick + scroll_delay; |
Linus Nielsen Feltzing | e43b78a | 2003-04-16 00:12:31 +0000 | [diff] [blame] | 972 | s->invert = false; |
| 973 | if (style & STYLE_INVERT) { |
| 974 | s->invert = true; |
| 975 | lcd_puts_style(x,y,string,STYLE_INVERT); |
| 976 | } |
| 977 | else |
| 978 | lcd_puts(x,y,string); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 979 | |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 980 | lcd_getstringsize(string, &w, &h); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 981 | |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 982 | if (LCD_WIDTH - x * 8 - xmargin < w) { |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 983 | /* prepare scroll line */ |
| 984 | char *end; |
| 985 | |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 986 | memset(s->line, 0, sizeof s->line); |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 987 | strcpy(s->line, string); |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 988 | |
| 989 | /* get width */ |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 990 | s->width = lcd_getstringsize(s->line, &w, &h); |
| 991 | |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 992 | /* scroll bidirectional or forward only depending on the string |
| 993 | width */ |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 994 | if ( bidir_limit ) { |
| 995 | s->bidir = s->width < (LCD_WIDTH - xmargin) * |
| 996 | (100 + bidir_limit) / 100; |
| 997 | } |
| 998 | else |
| 999 | s->bidir = false; |
| 1000 | |
| 1001 | if (!s->bidir) { /* add spaces if scrolling in the round */ |
| 1002 | strcat(s->line, " "); |
| 1003 | /* get new width incl. spaces */ |
| 1004 | s->width = lcd_getstringsize(s->line, &w, &h); |
| 1005 | } |
| 1006 | |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 1007 | end = strchr(s->line, '\0'); |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 1008 | strncpy(end, string, LCD_WIDTH/2); |
| 1009 | |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame^] | 1010 | s->len = utf8length(string); |
Björn Stenberg | d34fbd0 | 2002-09-24 22:44:59 +0000 | [diff] [blame] | 1011 | s->offset = 0; |
| 1012 | s->startx = x; |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1013 | s->backward = false; |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 1014 | scrolling_lines |= (1<<y); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1015 | } |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 1016 | else |
| 1017 | /* force a bit switch-off since it doesn't scroll */ |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 1018 | scrolling_lines &= ~(1<<y); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1019 | } |
| 1020 | |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1021 | static void scroll_thread(void) |
| 1022 | { |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1023 | struct font* pf; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1024 | struct scrollinfo* s; |
| 1025 | int index; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1026 | int xpos, ypos; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 1027 | int lastmode; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1028 | |
| 1029 | /* initialize scroll struct array */ |
Kjell Ericson | f5d9584 | 2003-01-23 14:24:52 +0000 | [diff] [blame] | 1030 | scrolling_lines = 0; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1031 | |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1032 | while ( 1 ) { |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1033 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1034 | /* really scroll? */ |
Kjell Ericson | f5d9584 | 2003-01-23 14:24:52 +0000 | [diff] [blame] | 1035 | if ( !(scrolling_lines&(1<<index)) ) |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1036 | continue; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1037 | |
Daniel Stenberg | edf4d8c | 2003-01-28 15:23:48 +0000 | [diff] [blame] | 1038 | s = &scroll[index]; |
| 1039 | |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1040 | /* check pause */ |
| 1041 | if (TIME_BEFORE(current_tick, s->start_tick)) |
| 1042 | continue; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1043 | |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1044 | if (s->backward) |
| 1045 | s->offset -= scroll_step; |
| 1046 | else |
| 1047 | s->offset += scroll_step; |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1048 | |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1049 | pf = font_get(curfont); |
| 1050 | xpos = xmargin + s->startx * s->width / s->len; |
Linus Nielsen Feltzing | 7c931a1 | 2004-07-09 11:21:13 +0000 | [diff] [blame] | 1051 | ypos = ymargin + index * pf->height; |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1052 | |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1053 | if (s->bidir) { /* scroll bidirectional */ |
| 1054 | if (s->offset <= 0) { |
| 1055 | /* at beginning of line */ |
| 1056 | s->offset = 0; |
| 1057 | s->backward = false; |
| 1058 | s->start_tick = current_tick + scroll_delay * 2; |
| 1059 | } |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1060 | if (s->offset >= s->width - (LCD_WIDTH - xpos)) { |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1061 | /* at end of line */ |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1062 | s->offset = s->width - (LCD_WIDTH - xpos); |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1063 | s->backward = true; |
| 1064 | s->start_tick = current_tick + scroll_delay * 2; |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1065 | } |
| 1066 | } |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1067 | else { |
Marcoen Hirschberg | 40d2209 | 2005-11-30 15:37:48 +0000 | [diff] [blame] | 1068 | /* scroll forward the whole time */ |
| 1069 | if (s->offset >= s->width) |
| 1070 | s->offset %= s->width; |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1071 | } |
| 1072 | |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 1073 | lastmode = drawmode; |
| 1074 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 1075 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 1076 | drawmode = DRMODE_SOLID; |
Björn Stenberg | a2e98c1 | 2002-12-12 15:20:37 +0000 | [diff] [blame] | 1077 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
Linus Nielsen Feltzing | e43b78a | 2003-04-16 00:12:31 +0000 | [diff] [blame] | 1078 | if (s->invert) |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 1079 | { |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 1080 | drawmode = DRMODE_COMPLEMENT; |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 1081 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
| 1082 | } |
Jens Arnold | 3a5bd7a | 2005-07-07 21:03:58 +0000 | [diff] [blame] | 1083 | drawmode = lastmode; |
Daniel Stenberg | 50b6358 | 2004-01-13 14:59:51 +0000 | [diff] [blame] | 1084 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1085 | } |
Markus Braun | bc254fe | 2002-10-21 13:14:25 +0000 | [diff] [blame] | 1086 | |
Jens Arnold | 566eae2 | 2004-10-15 20:30:29 +0000 | [diff] [blame] | 1087 | sleep(scroll_ticks); |
Björn Stenberg | 86f9a84 | 2002-09-23 11:17:52 +0000 | [diff] [blame] | 1088 | } |
| 1089 | } |
| 1090 | |