diff options
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index 54e1dc0cf2..6caf751b39 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -250,19 +250,19 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
250 | if (!lcd_on) | 250 | if (!lcd_on) |
251 | return; | 251 | return; |
252 | 252 | ||
253 | if ( (width | height) <= 0) | ||
254 | return; /* nothing left to do */ | ||
255 | |||
253 | if (x + width > LCD_WIDTH) | 256 | if (x + width > LCD_WIDTH) |
254 | width = LCD_WIDTH - x; /* Clip right */ | 257 | width = LCD_WIDTH - x; /* Clip right */ |
255 | if (x < 0) | 258 | if (x < 0) |
256 | width += x, x = 0; /* Clip left */ | 259 | width += x, x = 0; /* Clip left */ |
257 | if (width <= 0) | ||
258 | return; /* nothing left to do */ | ||
259 | 260 | ||
260 | if (y + height > LCD_HEIGHT) | 261 | if (y + height > LCD_HEIGHT) |
261 | height = LCD_HEIGHT - y; /* Clip bottom */ | 262 | height = LCD_HEIGHT - y; /* Clip bottom */ |
262 | if (y < 0) | 263 | if (y < 0) |
263 | height += y, y = 0; /* Clip top */ | 264 | height += y, y = 0; /* Clip top */ |
264 | if (height <= 0) | 265 | |
265 | return; /* nothing left to do */ | ||
266 | 266 | ||
267 | src = &lcd_framebuffer[y][x]; | 267 | src = &lcd_framebuffer[y][x]; |
268 | 268 | ||
@@ -284,20 +284,21 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
284 | dst=FRAME + (LCD_NATIVE_WIDTH*(LCD_NATIVE_HEIGHT-1)) | 284 | dst=FRAME + (LCD_NATIVE_WIDTH*(LCD_NATIVE_HEIGHT-1)) |
285 | - LCD_NATIVE_WIDTH*x + y ; | 285 | - LCD_NATIVE_WIDTH*x + y ; |
286 | 286 | ||
287 | do | 287 | while(height--) |
288 | { | 288 | { |
289 | register int c_width=width; | 289 | register int c_width=width; |
290 | register fb_data *c_dst=dst; | 290 | register fb_data *c_dst=dst; |
291 | do | 291 | |
292 | while(c_width--) | ||
292 | { | 293 | { |
293 | *c_dst=*src++; | 294 | *c_dst=*src++; |
294 | c_dst-=LCD_NATIVE_WIDTH; | 295 | c_dst-=LCD_NATIVE_WIDTH; |
295 | } | 296 | } |
296 | while(--c_width); | 297 | |
297 | src+=LCD_WIDTH-width-x; | 298 | src+=LCD_WIDTH-width; |
298 | dst++; | 299 | dst++; |
299 | } | 300 | } |
300 | while(--height); | 301 | |
301 | #endif | 302 | #endif |
302 | } | 303 | } |
303 | 304 | ||
@@ -357,35 +358,34 @@ void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | |||
357 | char *dst=(char *)FRAME+x+y*(LCD_NATIVE_WIDTH+LCD_FUDGE); | 358 | char *dst=(char *)FRAME+x+y*(LCD_NATIVE_WIDTH+LCD_FUDGE); |
358 | 359 | ||
359 | src=src+src_x+src_y*LCD_NATIVE_WIDTH; | 360 | src=src+src_x+src_y*LCD_NATIVE_WIDTH; |
360 | do | 361 | while(height--); |
361 | { | 362 | { |
362 | memcpy ( dst, src, width); | 363 | memcpy ( dst, src, width); |
363 | 364 | ||
364 | /* The LCD uses the top 1/4 of the screen when in palette mode */ | ||
365 | dst=dst+width+(LCD_NATIVE_WIDTH-x-width)+LCD_FUDGE; | 365 | dst=dst+width+(LCD_NATIVE_WIDTH-x-width)+LCD_FUDGE; |
366 | src+=width; | 366 | src+=width; |
367 | } | 367 | } |
368 | while(--height); | 368 | |
369 | #else | 369 | #else |
370 | char *dst=(char *)FRAME | 370 | char *dst=(char *)FRAME |
371 | + (LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1) | 371 | + (LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1) |
372 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y; | 372 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y; |
373 | 373 | ||
374 | src=src+src_x+src_y*LCD_WIDTH; | 374 | src=src+src_x+src_y*LCD_WIDTH; |
375 | do | 375 | while(height--) |
376 | { | 376 | { |
377 | register char *c_dst=dst; | 377 | register char *c_dst=dst; |
378 | register int c_width=width; | 378 | register int c_width=width; |
379 | do | 379 | |
380 | while (c_width--) | ||
380 | { | 381 | { |
381 | *c_dst=*src++; | 382 | *c_dst=*src++; |
382 | /* The LCD uses the top 1/4 of the screen when in palette mode */ | ||
383 | c_dst=c_dst-(LCD_NATIVE_WIDTH+LCD_FUDGE); | 383 | c_dst=c_dst-(LCD_NATIVE_WIDTH+LCD_FUDGE); |
384 | } while (--c_width); | 384 | } |
385 | |||
385 | dst++; | 386 | dst++; |
386 | src=src+(LCD_WIDTH-width-x); | 387 | src+=LCD_WIDTH-width; |
387 | } | 388 | } |
388 | while(--height); | ||
389 | #endif | 389 | #endif |
390 | } | 390 | } |
391 | 391 | ||
@@ -438,11 +438,9 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
438 | */ | 438 | */ |
439 | y &= ~1; | 439 | y &= ~1; |
440 | 440 | ||
441 | if(y<0 || y>LCD_NATIVE_HEIGHT || x<0 || x>LCD_NATIVE_WIDTH | 441 | if( ((y | x | height | width ) < 0) |
442 | || height<0 || width <0) | 442 | || y>LCD_NATIVE_HEIGHT || x>LCD_NATIVE_WIDTH ) |
443 | { | ||
444 | return; | 443 | return; |
445 | } | ||
446 | 444 | ||
447 | if(y+height>LCD_NATIVE_WIDTH) | 445 | if(y+height>LCD_NATIVE_WIDTH) |
448 | { | 446 | { |