Changeset 752 for trunk/core/gui_osd.c


Ignore:
Timestamp:
04/24/09 20:43:35 (4 years ago)
Author:
reyalp
Message:

zebra for variable aspect cams (currently SX1). From pev69 in http://chdk.setepontos.com/index.php/topic,3410.msg32518.html#msg32518

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui_osd.c

    r747 r752  
    225225// returns 1 if zebra should be drawn 
    226226static int gui_osd_zebra_init(int show) { 
     227        unsigned i; 
     228 
    227229    if(show) {  
    228230        if (!buf) { 
     
    247249                                gui_osd_zebra_free(); 
    248250                        } 
     251#if CAM_HAS_VARIABLE_ASPECT 
     252                        else // in variable aspect, the borders would never be cleared 
     253                                memset(buf,0,screen_buffer_size); 
     254#endif 
    249255        } 
    250256    } 
     
    355361    }; 
    356362         
     363    unsigned bWide = 1; // if wide (16:9) or standard (4:3) aspect ratio (but 1 in cameras that only have 4:3) 
     364    unsigned aspOffset = 0; // offset to add to x-coord (or buffer address) when drawing zebra 
     365 
     366#if CAM_HAS_VARIABLE_ASPECT 
     367    if (shooting_get_prop(PROPCASE_ASPECT_RATIO) == 0) // standard requires x-shift to overlay drawing 
     368    { 
     369        bWide = 0; 
     370        //aspOffset = (screen_width - (screen_width * 12 / 16)) / 2; // = actual calculation, simplified below 
     371        aspOffset = screen_width / 8; // half of the difference in width between equal height 16:9 and 4:3 screens, = black bar width 
     372    } 
     373#endif 
     374         
    357375    if (!gui_osd_zebra_init(show)) 
    358376        return 0; 
     
    425443        over = 255-conf.zebra_over; 
    426444            if (conf.zebra_multichannel) {step_x=2; step_v=6;} else {step_x=1; step_v=3;} 
    427             for (s=0, y=1, v=0; y<=viewport_height; ++y) { 
     445            s = aspOffset; 
     446            for (y=1, v=0; y<=viewport_height; ++y) { 
    428447                for (x=0; x<screen_width; x+=step_x, s+=step_x, v+=step_v) { 
    429448                    register int yy, uu, vv; 
    430449                    int sel; 
     450                                                                                 
     451                    if (!bWide && (x + aspOffset >= screen_width - aspOffset)) continue; // do not draw "outside screen"  
     452                                                                                 
    431453                    yy = img_buf[v+1]; 
    432454                    if (conf.zebra_multichannel) { 
Note: See TracChangeset for help on using the changeset viewer.