Changeset 15278
- Timestamp:
- 04/16/12 00:03:43 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/defaults.h
r15272 r15278 85 85 status.topoffset = getconfigint("fbtopoffset", NULL); 86 86 status.bottomoffset = getconfigint("fbbottomoffset", NULL); 87 status.createthump = getconfigint("createthump", NULL); 87 88 88 89 status.bgpic = getskinconfig("bgpic", NULL); -
titan/titan/skin.h
r15275 r15278 1390 1390 } 1391 1391 1392 unsigned char *loadjpg(char *filename, int *width, int *height, int denom) 1393 { 1394 struct jpeg_decompress_struct cinfo; 1395 struct jpeg_decompress_struct *ciptr = &cinfo; 1396 struct jpgerror jerr; 1397 FILE *fd = NULL; 1398 unsigned char *buf = NULL; 1399 1400 fd = fopen(filename, "rb"); 1401 if(fd == NULL) 1402 { 1403 perr("open jpg file %s", filename); 1404 return NULL; 1405 } 1406 1407 ciptr->err = jpeg_std_error(&jerr.jerr); 1408 jerr.jerr.error_exit = jpgswerror; 1409 if(setjmp(jerr.setjmpbuf)) 1410 { 1411 jpeg_destroy_decompress(ciptr); 1412 fclose(fd); 1413 return NULL; 1414 } 1415 1416 jpeg_create_decompress(ciptr); 1417 jpeg_stdio_src(ciptr, fd); 1418 jpeg_read_header(ciptr, TRUE); 1419 ciptr->out_color_space = JCS_RGB; 1420 ciptr->scale_denom = denom; 1421 1422 jpeg_start_decompress(ciptr); 1423 1424 *width = ciptr->output_width; 1425 *height = ciptr->output_height; 1426 1427 if(ciptr->output_components == 3) 1428 { 1429 JSAMPLE *lb = (JSAMPLE *)(*ciptr->mem->alloc_small)((j_common_ptr) ciptr, JPOOL_PERMANENT, ciptr->output_width * ciptr->output_components); 1430 buf = malloc(ciptr->output_height * ciptr->output_width * ciptr->output_components); 1431 if(buf == NULL) 1432 { 1433 err("no mem"); 1434 jpeg_destroy_decompress(ciptr); 1435 fclose(fd); 1436 return NULL; 1437 } 1438 1439 unsigned char *bp = buf; 1440 1441 while(ciptr->output_scanline < ciptr->output_height) 1442 { 1443 jpeg_read_scanlines(ciptr, &lb, 1); 1444 memcpy(bp, lb, ciptr->output_width * ciptr->output_components); 1445 bp += ciptr->output_width * ciptr->output_components; 1446 } 1447 } 1448 1449 jpeg_finish_decompress(ciptr); 1450 jpeg_destroy_decompress(ciptr); 1451 fclose(fd); 1452 return(buf); 1453 } 1454 1455 int savejpg(char * filename, int width, int height, unsigned char *buf) 1456 { 1457 struct jpeg_compress_struct cinfo; 1458 struct jpeg_error_mgr jerr; 1459 FILE * outfile; 1460 JSAMPROW pointer[1]; 1461 int stride; 1462 1463 cinfo.err = jpeg_std_error(&jerr); 1464 jpeg_create_compress(&cinfo); 1465 1466 if((outfile = fopen(filename, "wb")) == NULL) 1467 { 1468 perr("jpeg can't open %s", filename); 1469 return 1; 1470 } 1471 1472 jpeg_stdio_dest(&cinfo, outfile); 1473 1474 cinfo.image_width = width; 1475 cinfo.image_height = height; 1476 cinfo.input_components = 3; 1477 cinfo.in_color_space = JCS_RGB; 1478 jpeg_set_defaults(&cinfo); 1479 jpeg_set_quality(&cinfo, 70, TRUE); 1480 jpeg_start_compress(&cinfo, TRUE); 1481 stride = width * 3; 1482 1483 while (cinfo.next_scanline < cinfo.image_height) 1484 { 1485 pointer[0] = & buf[cinfo.next_scanline * stride]; 1486 jpeg_write_scanlines(&cinfo, pointer, 1); 1487 } 1488 1489 jpeg_finish_compress(&cinfo); 1490 fclose(outfile); 1491 jpeg_destroy_compress(&cinfo); 1492 return 0; 1493 } 1494 1392 1495 int readjpgsw(const char* filename, int posx, int posy, int mwidth, int mheight, int scalewidth, int scaleheight, int halign, int valign) 1393 1496 { … … 1958 2061 { 1959 2062 // debug(1000, "in"); 1960 int space = 0, row, pitch, bit, y = 0, x = 0, px = 0, py = 0, pxw = 0, pyh = 0, max = 220, min = 35;2063 int space = 0, y = 0, x = 0, py = 0, pxw = 0, pyh = 0, max = 220, min = 35; 1961 2064 FT_UInt glyphindex; 1962 2065 FT_Vector kerning; … … 3523 3626 merkskinfb = NULL; 3524 3627 } 3525 else { 3628 else 3629 { 3526 3630 if(ostrcmp(getconfig("write_fb_to_jpeg", NULL), "yes") == 0) 3527 3631 write_FB_to_JPEG_file(skinfb->fb, skinfb->width, skinfb->height, "/tmp/fb.jpg", 3); -
titan/titan/struct.h
r15271 r15278 193 193 { 194 194 //0-99 for ca module 195 //101 for thump thread 195 196 int type; 196 197 int flag; … … 1057 1058 //background picture for all screens 1058 1059 char* bgpic; 1060 //should thump thread start 1061 int createthump; 1059 1062 } status; 1060 1063 -
titan/titan/titan.c
r15272 r15278 178 178 #include "rguid.h" 179 179 #include "channelhistroy.h" 180 #include "thump.h" 180 181 //#include "cardreader.h" 181 182 //#include "sci.h" … … 751 752 //check if box starts from a record 752 753 addtimer(&checkboxstartthread, START, 1000, 1, NULL, NULL, NULL); 753 //check net754 //check kill net (security) 754 755 addtimer(&ckeckkillnetthread, START, 1000, 1, NULL, NULL, NULL); 756 //thump create thread 757 if(getconfigint("createthump", NULL) == 1) 758 addtimer(&thumpthread, START, 1000, 1, NULL, NULL, NULL); 755 759 756 760 //start webserver
Note: See TracChangeset
for help on using the changeset viewer.