Changeset 1250 for trunk/core/gui_draw.c


Ignore:
Timestamp:
07/28/11 11:42:13 (22 months ago)
Author:
philmoz
Message:

Fix for CHDK sometimes forgetting to redraw the menus.
See - http://chdk.setepontos.com/index.php?topic=6659.0
Added an optional system for detecting if the camera firmware has erased the screen, and force a menu redraw (define CAM_DETECT_SCREEN_ERASE in platform_camera.h to enable).
Updated comment for CAM_MENU_BORDERWIDTH in camera.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_draw.c

    r1234 r1250  
    6060   draw_set_aspect_xcorrection_proc(xcorrection_proc); 
    6161   draw_set_aspect_ycorrection_proc(ycorrection_proc); 
     62} 
     63 
     64#endif 
     65 
     66//------------------------------------------------------------------- 
     67#ifdef CAM_DETECT_SCREEN_ERASE 
     68 
     69#define GUARD_VAL   SCREEN_COLOR 
     70 
     71void draw_set_guard() 
     72{ 
     73    *((unsigned char*)(frame_buffer[0])) = GUARD_VAL; 
     74    *((unsigned char*)(frame_buffer[1])) = GUARD_VAL; 
     75} 
     76 
     77int draw_test_guard() 
     78{ 
     79    if (*((unsigned char*)(frame_buffer[0])) != GUARD_VAL) return 0; 
     80    if (*((unsigned char*)(frame_buffer[1])) != GUARD_VAL) return 0; 
     81    return 1; 
     82} 
     83 
     84// Test a pixel value in both frame buffers, returns 0 if either doesn't match or co-ords out of range 
     85int draw_test_pixel(coord x, coord y, color c) 
     86{ 
     87    if (x >= screen_width || y >= screen_height) return 0; 
     88#if CAM_USES_ASPECT_CORRECTION 
     89    return (frame_buffer[0][y * screen_buffer_width + aspect_xcorrection_proc(x)] == c) && 
     90           (frame_buffer[1][y * screen_buffer_width + aspect_xcorrection_proc(x)] == c); 
     91#else 
     92    return (frame_buffer[0][y * screen_buffer_width + x] == c) && 
     93           (frame_buffer[1][y * screen_buffer_width + x] == c); 
     94#endif 
    6295} 
    6396 
     
    81114      draw_set_aspect_ycorrection_proc(NULL); 
    82115    #endif 
     116 
     117#ifdef CAM_DETECT_SCREEN_ERASE 
     118    draw_set_guard(); 
     119#endif 
    83120} 
    84121 
     
    377414void draw_restore() { 
    378415    vid_bitmap_refresh(); 
     416 
     417#ifdef CAM_DETECT_SCREEN_ERASE 
     418    draw_set_guard(); 
     419#endif 
    379420} 
    380421 
Note: See TracChangeset for help on using the changeset viewer.