summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-c200/lcd-c200.c')
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/lcd-c200.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
index ef336b46c0..d503fd2c9b 100644
--- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
+++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
@@ -206,19 +206,49 @@ void lcd_blit(const fb_data* data, int x, int by, int width,
206 (void)stride; 206 (void)stride;
207} 207}
208 208
209/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
210extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
211 int width,
212 int stride);
209/* Performance function to blit a YUV bitmap directly to the LCD */ 213/* Performance function to blit a YUV bitmap directly to the LCD */
210void lcd_yuv_blit(unsigned char * const src[3], 214void lcd_yuv_blit(unsigned char * const src[3],
211 int src_x, int src_y, int stride, 215 int src_x, int src_y, int stride,
212 int x, int y, int width, int height) 216 int x, int y, int width, int height)
213{ 217{
214 (void)src; 218 unsigned char const * yuv_src[3];
215 (void)src_x; 219 off_t z;
216 (void)src_y; 220
217 (void)stride; 221 /* Sorry, but width and height must be >= 2 or else */
218 (void)x; 222 width &= ~1;
219 (void)y; 223 height >>= 1;
220 (void)width; 224
221 (void)height; 225 y += 0x1a;
226
227 z = stride*src_y;
228 yuv_src[0] = src[0] + z + src_x;
229 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
230 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
231
232 lcd_send_command(R_ENTRY_MODE);
233 lcd_send_command(0x80);
234
235 lcd_send_command(R_X_ADDR_AREA);
236 lcd_send_command(x);
237 lcd_send_command(x + width - 1);
238
239 do
240 {
241 lcd_send_command(R_Y_ADDR_AREA);
242 lcd_send_command(y);
243 lcd_send_command(y + 1);
244
245 lcd_write_yuv420_lines(yuv_src, width, stride);
246 yuv_src[0] += stride << 1; /* Skip down two luma lines */
247 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
248 yuv_src[2] += stride >> 1;
249 y += 2;
250 }
251 while (--height > 0);
222} 252}
223 253
224/* Update the display. 254/* Update the display.
@@ -239,6 +269,9 @@ void lcd_update_rect(int x0, int y0, int width, int height)
239 if ((x1 <= 0) || (y1 <= 0)) 269 if ((x1 <= 0) || (y1 <= 0))
240 return; 270 return;
241 271
272 lcd_send_command(R_ENTRY_MODE);
273 lcd_send_command(0x82);
274
242 if(y1 >= LCD_HEIGHT) 275 if(y1 >= LCD_HEIGHT)
243 y1 = LCD_HEIGHT - 1; 276 y1 = LCD_HEIGHT - 1;
244 277