Changeset 486
- Timestamp:
- 08/16/08 21:54:21 (2 years ago)
- Files:
-
- branches/juciphox/core/gui_draw.c (modified) (2 diffs)
- branches/juciphox/core/gui_osd.c (modified) (9 diffs)
- branches/juciphox/core/luascript.c (modified) (3 diffs)
- branches/juciphox/doc/version.txt (modified) (1 diff)
- branches/juciphox/version.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/juciphox/core/gui_draw.c
r416 r486 41 41 //------------------------------------------------------------------- 42 42 void draw_pixel(coord x, coord y, color cl) { 43 if (x >= screen_width || y >= screen_height) return;43 if (x < 0 || y < 0 || x >= screen_width || y >= screen_height) return; 44 44 else { 45 45 register unsigned int offset = y * screen_buffer_width + x; … … 196 196 // XXX optimize. probably use 4bit -> 32bit lookup table 197 197 // so 4(8) pixels were drawn at a time 198 for (i=0; i<FONT_HEIGHT; i++){ 199 for (ii=0; ii<FONT_WIDTH; ii++){ 200 draw_pixel(x+ii ,y+i, (sym[i] & (0x80>>ii))? cl&0xff : cl>>8); 198 for (i=-1; i<=FONT_HEIGHT; i++){ 199 for (ii=-1; ii<=FONT_WIDTH; ii++){ 200 int inside_box = (i>=0 && i<FONT_HEIGHT && ii>=0 && ii<FONT_WIDTH); 201 if(inside_box && sym[i] & (0x80>>ii)) { 202 draw_pixel(x+ii ,y+i, cl&0xff); 203 } else { 204 if (i>0 && (sym[i-1] & (0x80>>ii))) draw_pixel(x+ii, y+i, COLOR_BLACK); 205 else if(i<FONT_HEIGHT-1 && (sym[i+1] & (0x80>>ii))) draw_pixel(x+ii, y+i, COLOR_BLACK); 206 else if(ii>0 && (sym[i] & (0x80>>(ii-1)))) draw_pixel(x+ii, y+i, COLOR_BLACK); 207 else if(ii<FONT_WIDTH-1 && (sym[i] & (0x80>>(ii+1)))) draw_pixel(x+ii, y+i, COLOR_BLACK); 208 else if(inside_box && cl>>8!=COLOR_TRANSPARENT) draw_pixel(x+ii ,y+i, cl>>8); 209 } 201 210 } 202 211 } branches/juciphox/core/gui_osd.c
r479 r486 47 47 static char osd_buf2[64]; 48 48 static int step; 49 static unsigned char *img_buf, *scr_buf ;49 static unsigned char *img_buf, *scr_buf, *cur_buf; 50 50 static int timer = 0; 51 51 static char *buf = NULL; … … 195 195 } 196 196 197 int draw_guard_pixel() { 198 unsigned char* buffer1 = vid_get_bitmap_fb()+screen_buffer_size/2; 199 unsigned char* buffer2 = buffer1+screen_buffer_size; 200 int has_disappeared=0; 201 202 if(*buffer1!=COLOR_GREEN) has_disappeared=1; 203 if(*buffer2!=COLOR_GREEN) has_disappeared=2; 204 *buffer1 = *buffer2 = COLOR_GREEN; 205 return has_disappeared; 206 } 207 208 197 209 //------------------------------------------------------------------- 198 210 static void gui_osd_draw_zebra_osd() { 211 color old_osd_color=conf.osd_color; 212 conf.osd_color=MAKE_COLOR(COLOR_TRANSPARENT, conf.osd_color); 199 213 switch (conf.zebra_draw_osd) { 200 214 case ZEBRA_DRAW_NONE: … … 241 255 break; 242 256 } 257 conf.osd_color=old_osd_color; 243 258 } 244 259 … … 267 282 buf = malloc(screen_buffer_size); 268 283 scr_buf = vid_get_bitmap_fb(); 284 cur_buf = malloc(screen_buffer_size); 269 285 } 270 286 271 287 if (buf) { 288 if(timer==0) { 289 draw_guard_pixel(); 290 timer=1; 291 return 0; 292 } 293 if(timer==1) { 294 short ready; 295 static int n=0; 296 get_property_case(PROPCASE_SHOOTING, &ready, 4); 297 n=draw_guard_pixel(); 298 if(!ready || n==0) return 0; 299 if(n==1) memcpy(cur_buf, scr_buf, screen_buffer_size); 300 else memcpy(cur_buf, scr_buf+screen_buffer_size, screen_buffer_size); 301 } 272 302 ++timer; 273 303 img_buf=((mode_get()&MODE_MASK) == MODE_PLAY)?vid_get_viewport_fb_d():vid_get_viewport_fb(); … … 284 314 break; 285 315 case ZEBRA_MODE_BLINKED_1: 286 f = timer& 2;316 f = timer&1; 287 317 break; 288 318 case ZEBRA_MODE_BLINKED_3: 289 f = timer& 8;319 f = timer&4; 290 320 break; 291 321 case ZEBRA_MODE_BLINKED_2: 292 322 default: 293 f = timer& 4;323 f = timer&2; 294 324 break; 295 325 } … … 316 346 else if (((conf.zebra_mode == ZEBRA_MODE_ZEBRA_1 || conf.zebra_mode == ZEBRA_MODE_ZEBRA_2) && (y-x-timer)&f)) buf[s]=COLOR_TRANSPARENT; 317 347 else buf[s]=(yy>over)?cl_over:(yy<conf.zebra_under)?cl_under:COLOR_TRANSPARENT; 318 if (buf[s] != COLOR_TRANSPARENT && !zebra_drawn) zebra_drawn = 1; 348 if (buf[s] != COLOR_TRANSPARENT && !zebra_drawn) zebra_drawn = 1; 349 if(cur_buf[s]!=COLOR_TRANSPARENT) buf[s]=cur_buf[s]; 350 if(conf.zebra_multichannel && cur_buf[s+1]!=COLOR_TRANSPARENT) buf[s+1]=cur_buf[s+1]; 319 351 } 320 352 s+=screen_buffer_width-screen_width; … … 331 363 draw_restore(); 332 364 } else { 333 mem set(buf, COLOR_TRANSPARENT, screen_buffer_size);365 memcpy(buf, cur_buf, screen_buffer_size); 334 366 gui_osd_draw_zebra_osd(); 335 367 memcpy(scr_buf, buf, screen_buffer_size); … … 392 424 //------------------------------------------------------------------- 393 425 void gui_osd_draw_histo() { 426 static long old_histo_magnification=0; 394 427 switch (conf.histo_layout) { 395 428 case OSD_HISTO_LAYOUT_Y: … … 442 475 } 443 476 if ((conf.show_overexp ) && kbd_is_key_pressed(KEY_SHOOT_HALF) && (under_exposed || over_exposed)) 444 draw_string(conf.histo_pos.x+HISTO_WIDTH-FONT_WIDTH*3, conf.histo_pos.y-FONT_HEIGHT, "EXP", conf. histo_color);477 draw_string(conf.histo_pos.x+HISTO_WIDTH-FONT_WIDTH*3, conf.histo_pos.y-FONT_HEIGHT, "EXP", conf.osd_color); 445 478 if (conf.histo_auto_ajust){ 446 479 if (histo_magnification) { 447 480 sprintf(osd_buf, " %d.%02dx ", histo_magnification/1000, histo_magnification/10%100); 448 draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, osd_buf, conf. histo_color);481 draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, osd_buf, conf.osd_color); 449 482 } else if (gui_get_mode()==GUI_MODE_OSD){ 450 483 draw_string(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, " 9.99x ", conf.histo_color); 451 } else {484 } else if (old_histo_magnification) { 452 485 draw_filled_rect(conf.histo_pos.x, conf.histo_pos.y-FONT_HEIGHT, conf.histo_pos.x+8*FONT_WIDTH, conf.histo_pos.y-1, MAKE_COLOR(COLOR_TRANSPARENT, COLOR_TRANSPARENT)); 453 486 } 454 487 } 488 old_histo_magnification=histo_magnification; 455 489 } 456 490 branches/juciphox/core/luascript.c
r479 r486 10 10 #include "shot_histogram.h" 11 11 #include "ubasic.h" 12 #include "stdlib.h" 12 13 13 14 static int luaCB_shoot( lua_State* L ) … … 634 635 } 635 636 lua_pushnumber( L, temp ); 637 return 1; 638 } 639 640 static int luaCB_get_time( lua_State* L ) 641 { 642 int r = -1; 643 unsigned long t2 = time(NULL); 644 static struct tm *ttm; 645 ttm = localtime(&t2); 646 const char *t = luaL_checkstring( L, 1 ); 647 if (strncmp("s", t, 1)==0) r = ( L, ttm->tm_sec ); 648 else if (strncmp("m", t, 1)==0) r = ( L, ttm->tm_min ); 649 else if (strncmp("h", t, 1)==0) r = ( L, ttm->tm_hour ); 650 else if (strncmp("D", t, 1)==0) r = ( L, ttm->tm_mday ); 651 else if (strncmp("M", t, 1)==0) r = ( L, ttm->tm_mon+1 ); 652 else if (strncmp("Y", t, 1)==0) r = ( L, 1900+ttm->tm_year ); 653 lua_pushnumber( L, r ); 636 654 return 1; 637 655 } … … 832 850 FUNC(bitnot); 833 851 834 } 852 FUNC(get_time); 853 } branches/juciphox/doc/version.txt
r484 r486 5 5 6 6 log 7 8 486 / 0.3.6 9 Jucifer 10 11 + added LjL's cropped zebra -mod (http://chdk.setepontos.com/index.php/topic,1849.msg17467.html#msg17467) 12 + added get_time("unit") for Lua, where unit can be Y[ear], M[onth], D[ay], h[our], m[inute] or s[econd] ([]=optional/example) 13 7 14 8 15 0.3.5 / PP branches/juciphox/version.inc
r484 r486 1 BUILD_NUMBER := 0.3. 51 BUILD_NUMBER := 0.3.6