int currentselected;
} CairoInfo;
-extern long check_existence(const char *file_path);
extern int cairo_ui_init(int width, int height);
extern void cairo_ui_exit(void);
extern void cairo_clear_window(void);
extern void cairo_mask_image(void);
extern void cairo_update_screen(unsigned int * buffer, unsigned int size);
extern void cairo_draw_main_img(void);
-extern void cairo_draw_main_text_img(void);
extern void cairo_draw_progress_bar(unsigned int progress);
extern void cairo_draw_num_progress(int progress, int total);
extern void cairo_draw_text(void);
#define PROGRESS_NUM_PREFIX "tw_fota_downloading_"
#define SLASH_IMG_NAME "tw_fota_downloading_slash.png"
-#define RO_TEXT_IMG_FILE_PATH "/opt/usr/data/fota/FotaBgImage2.png"
-
#define MAX_FILE_PATH 512
#define PROGRESS_IMG_CNT 101
#define TEXT_FONT_SIZE_MIN 16
static cairo_surface_t *img_surf_main = NULL;
-static cairo_surface_t *img_surf_main_txt = NULL;
static cairo_surface_t *img_surf_num[PROGRESS_NUM_CNT] = {NULL,};
static cairo_surface_t *img_surf_slash = NULL;
_FUNC_EXIT;
}
-long check_existence(const char *file_path)
-{
- _FUNC_ENTER;
-
- if (file_path == NULL) {
- _DEBUG_EXCEPTION("Inputted paramter is wrong");
- _FUNC_EXIT;
- return 0;
- }
- _DEBUG_LOG("%s\n", file_path);
-
- struct stat statbuf;
- char filename[MAX_FILE_PATH] = {0,};
-
- if (strncpy(filename, file_path, strlen(file_path) + 1) == NULL) {
- _DEBUG_EXCEPTION("strncpy error=%s\n", filename);
- _FUNC_EXIT;
- return 0;
- }
- if (stat(filename, &statbuf)) {
- if (ENOENT == errno) {
- _DEBUG_EXCEPTION("stat %s: %m\n", filename);
- _FUNC_EXIT;
- return 0;
- }
- }
- _DEBUG_LOG("satbuf.st_size = %d\n", (int)statbuf.st_size);
-
- _FUNC_EXIT;
- return statbuf.st_size;
-}
-
/*-----------------------------------------------------------------*
cairo_image_init()
------------------------------------------------------------------*/
_DEBUG_LOG("img name = %s\n", img_name);
img_surf_slash = cairo_image_surface_create_from_png(img_name);
- if (check_existence((char *)RO_TEXT_IMG_FILE_PATH) > 0)
- img_surf_main_txt = cairo_image_surface_create_from_png(RO_TEXT_IMG_FILE_PATH);
-
main_img_w = cairo_image_surface_get_width(img_surf_main);
main_img_h = cairo_image_surface_get_height(img_surf_main);
main_img_x = (cairoinfo.width - main_img_w)/2;
cairo_surface_destroy(img_surf_num[i]);
cairo_surface_destroy(img_surf_slash);
- if (check_existence((char *)RO_TEXT_IMG_FILE_PATH) > 0)
- cairo_surface_destroy(img_surf_main_txt);
-
_FUNC_EXIT;
}
#endif
}
-void cairo_draw_main_text_img(void)
-{
- _FUNC_ENTER;
-
- if (img_surf_main_txt) {
- cairo_set_source_surface(cairoinfo.Cr, img_surf_main_txt, main_img_x, main_img_y);
- cairo_rectangle(cairoinfo.Cr, main_img_x, main_img_y, main_img_w, main_img_h);
- cairo_fill(cairoinfo.Cr);
- }
-
- _FUNC_EXIT;
-}
-
void cairo_draw_progress_bar(unsigned int progress)
{
_FUNC_ENTER;
cairo_clear_window();
/* draw main text image */
- if (check_existence((char *)RO_TEXT_IMG_FILE_PATH) > 0) {
- cairo_draw_main_text_img();
- } else {
- pthread_t th_id;
-
- int error = pthread_create(&th_id, NULL, __thread_font_init, NULL);
- if (error != 0) {
- _DEBUG_EXCEPTION("Thread creation failed errno [%d]\n", errno);
- _FUNC_EXIT;
- return -1;
- }
+ pthread_t th_id;
+
+ int error = pthread_create(&th_id, NULL, __thread_font_init, NULL);
+ if (error != 0) {
+ _DEBUG_EXCEPTION("Thread creation failed errno [%d]\n", errno);
+ _FUNC_EXIT;
+ return -1;
}
_FUNC_EXIT;