static S32 mmi_em_profiling_gdi_misc_2d_nb(void *v_param) { gdi_handle src_layer, dest_layer; gdi_lt_matrix_struct affine_transform = { { 1.8f, 0.0f, 5.0f, 0.0f, 1.9f, 5.0f, 0.0f, 0.0f, 1.0f } }; src_layer = mmi_em_profiling_gdi_create_layer(GDI_COLOR_FORMAT_32_PARGB, 0, 0, 100, 100); dest_layer = mmi_em_profiling_gdi_create_layer(GDI_COLOR_FORMAT_32_PARGB, 0, 0, 200, 200); gdi_layer_push_and_set_active(src_layer); gdi_layer_clear(GDI_COLOR_GREEN); gdi_image_draw_id(0, 0, IMG_GLOBAL_QUESTION); gdi_layer_set_active(dest_layer); gdi_layer_clear(GDI_COLOR_BLACK); gdi_2d_linear_transfrom( affine_transform.m, src_layer, 0, 0, 100, 100, 0, 0, 200, 200, GDI_LT_SRC_KEY_EDGE_FILTER_DULPLICATE, GDI_COLOR_WHITE, GDI_LT_SAMPLE_MODE_BILINEAR_WITH_EDGE_FILTER_DULPLICATE, GDI_LT_FLAG_NON_BLOCKING); gdi_layer_pop_and_restore_active(); gdi_2d_fill_rect( dest_layer, dest_layer, 50, 50, 100, 100, 255, gdi_cf_get_color(GDI_COLOR_FORMAT_32_PARGB, 128, 255, 255, 255), GDI_2D_FILL_FLAG_ALPHA_BLENDING | GDI_2D_FILL_FLAG_NON_BLOCKING, NULL); gdi_2d_fill_rect_wait_for_finish(); mmi_em_profiling_gdi_misc_blt_case(dest_layer, 0, 0, 0); mmi_em_profiling_gdi_free_layer(src_layer); mmi_em_profiling_gdi_free_layer(dest_layer); return 0; }
/***************************************************************************** * FUNCTION * mmi_sample_drawing_image * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_sample_drawing_image(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 image_width; S32 image_height; S32 offset_x; S32 offset_y; GDI_RESULT ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* clear base layer as black */ gdi_layer_clear(GDI_COLOR_BLACK); /* get image size */ ret = gdi_image_get_dimension_id(IMG_ID_DEVAPP_1, &image_width, &image_height); if (ret < 0) { /* error handling */ } /* align at center */ offset_x = (UI_device_width - image_width) >> 1; offset_y = (UI_device_width - image_height) >> 1; gdi_image_draw_id(offset_x, offset_y, IMG_ID_DEVAPP_1); }
void mmi_frm_screen_rotate_handler(void) { if(mmi_frm_get_screen_rotate() != g_mmi_frm_screen_rotate_new ) { mmi_frm_screen_rotate(g_mmi_frm_screen_rotate_new); gdi_layer_clear(GDI_COLOR_BLACK); } }
static gdi_handle mmi_em_profiling_gdi_misc_fill_rect_create_layer( gdi_color_format cf) { gdi_handle layer; layer = mmi_em_profiling_gdi_create_layer( cf, 0, 0, 100, 100); gdi_layer_push_and_set_active(layer); gdi_layer_clear(GDI_COLOR_BLUE); gdi_layer_pop_and_restore_active(); return layer; }
void SFApp_SetupGDI(void) { gdi_handle gdi_hdlr; #if 0 //forrest lcd_power_up(); #endif entry_full_screen(); gdi_layer_reset_clip(); gdi_layer_get_base_handle(&gdi_hdlr); gdi_layer_set_blt_layer(gdi_hdlr,0,0,0); gdi_layer_clear(GDI_COLOR_BLACK); gdi_layer_set_active(gdi_hdlr); mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED); }
/***************************************************************************** * FUNCTION * mmi_frm_reset_screen_rotation * DESCRIPTION * Reset screen rotation and context and reset the rotation of base layer. * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_frm_reset_screen_rotation(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MMI_BOOL clear_flag = MMI_FALSE; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (g_mmi_frm_self_screen_rotate >= 0) { g_mmi_frm_previous_screen_rotate = (mmi_frm_screen_rotate_enum) g_mmi_frm_self_screen_rotate; g_mmi_frm_self_screen_rotate = -1; /* Unnecessary to set 'clear_flag' because the application will do it in its screen exit handler */ } else { g_mmi_frm_previous_screen_rotate = g_mmi_frm_screen_rotate; if (g_mmi_frm_screen_rotate != MMI_FRM_SCREEN_ROTATE_0) { clear_flag= MMI_TRUE; } } mmi_frm_screen_rotate(MMI_FRM_SCREEN_ROTATE_0); /* * Note: after screen is rotated, the content of LCD double buffer is wrong. * * If backlight was off and the next screen turn on backlight, it will BLT the * content of LCD double buffer to the screen, and the screen is messed. * * Framework should be responsible to clear the screen to black to avoid blinking * when backlight is turned on. */ if (clear_flag) { gdi_layer_clear(GDI_COLOR_BLACK); } }
/***************************************************************************** * FUNCTION * mmi_sample_drawing_start_animation * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_sample_drawing_start_animation(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 image_width; S32 image_height; S32 offset_x; S32 offset_y; GDI_RESULT ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* clear base layer as black */ gdi_layer_clear(GDI_COLOR_BLACK); /* get image size */ ret = gdi_image_get_dimension_id(IMG_ID_DEVAPP_1, &image_width, &image_height); if (ret < 0) { /* error handling */ } /* align at center */ offset_x = (UI_device_width - image_width) >> 1; offset_y = (UI_device_width - image_height) >> 1; sample_drawing_p->anim_handle = 0; ret = gdi_image_draw_animation_id(offset_x, offset_y, IMG_ID_DEVAPP_1, &sample_drawing_p->anim_handle); /* >= 0 means no error */ if (ret >= 0) { gui_start_timer(1000, mmi_sample_drawing_stop_animation); } }
void SFApp_SetupGDI(void) { gdi_handle gdi_hdlr; lcd_power_up(); entry_full_screen(); gdi_layer_reset_clip(); gdi_layer_get_base_handle(&gdi_hdlr); gdi_layer_set_blt_layer(gdi_hdlr,0,0,0); gdi_layer_set_active(gdi_hdlr); gdi_layer_clear(GDI_COLOR_BLACK); TurnOnBacklight(0); gdi_layer_blt_ext(GDI_LAYER_MAIN_BASE_LAYER_HANDLE, 0, 0, 0, #ifdef GDI_6_LAYERS 0, 0, #endif 0, 0, LCD_WIDTH-1, LCD_HEIGHT-1); gdi_layer_lock_frame_buffer(); mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED); /* gdi_handle gdi_hdlr; lcd_power_up(); entry_full_screen(); gdi_layer_reset_clip(); gdi_layer_get_base_handle(&gdi_hdlr); gdi_layer_set_blt_layer(gdi_hdlr,0,0,0); gdi_layer_set_active(gdi_hdlr); mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED); */ }
static S32 mmi_em_profiling_gdi_misc_fill_rect_src2(void *v_param) { gdi_handle src_layer; gdi_handle dest_layer; dest_layer = mmi_em_profiling_gdi_misc_fill_rect_create_layer(GDI_COLOR_FORMAT_32_PARGB); src_layer = mmi_em_profiling_gdi_create_layer(GDI_COLOR_FORMAT_16, 0, 0, 100, 100); gdi_layer_push_and_set_active(src_layer); gdi_layer_clear(GDI_COLOR_RED); gdi_layer_pop_and_restore_active(); gdi_2d_fill_rect( src_layer, dest_layer, 30, 30, 60, 60, 128, gdi_cf_get_color(GDI_COLOR_FORMAT_16, 255, 255, 255, 255), GDI_2D_FILL_FLAG_ALPHA_BLENDING, NULL); mmi_em_profiling_gdi_misc_blt_case(dest_layer, 0, 0, 0); mmi_em_profiling_gdi_free_layer(src_layer); mmi_em_profiling_gdi_free_layer(dest_layer); return 0; }
static S32 mmi_em_profiling_gdi_misc_speed_sw_fill_rect(void *v_param) { static const U32 PROFILING_MS = 4000; gdi_handle layer; S32 i; U32 start_time, duration; mmi_em_profiling_gdi_misc_speec_fill_rect_param *param = (mmi_em_profiling_gdi_misc_speec_fill_rect_param*)v_param; kal_int32 fill_x, fill_y, fill_width, fill_height; gdi_color fill_color; layer = mmi_em_profiling_gdi_create_layer( param->layer.cf, param->layer.x, param->layer.y, param->layer.width, param->layer.height); if (layer == 0) { return -1; } gdi_layer_push_and_set_active(layer); gdi_layer_clear(GDI_COLOR_BLACK); gdi_layer_pop_and_restore_active(); fill_x = param->fill.x; fill_y = param->fill.y; fill_width = param->fill.width; fill_height = param->fill.height; fill_color = gdi_cf_get_color(param->layer.cf, 255, 255, 255, 255); gdi_layer_push_and_set_active(layer); MMI_TRACE(MMI_COMMON_TRC_INFO, TRC_APP_EM_PROFILING_GDI_FRECT_START); start_time = drv_get_current_time(); i = 0; do { do { gdi_draw_solid_rect( fill_x, fill_y, fill_width, fill_height, fill_color); i++; } while ((i & 0xf) != 0); /* Calculate duration every 16 iterations */ duration = drv_get_duration_ms(start_time); } #ifdef __MTK_TARGET__ while (duration < PROFILING_MS); #else while (0); #endif MMI_TRACE(MMI_COMMON_TRC_INFO, TRC_APP_EM_PROFILING_GDI_FRECT_END, param->id, i, duration); gdi_layer_pop_and_restore_active(); gdi_layer_blt( layer, 0, 0, 0, 0, 0, GDI_LCD_WIDTH - 1, GDI_LCD_HEIGHT - 1); mmi_em_profiling_gdi_free_layer(layer); return 0; }
/***************************************************************************** * FUNCTION * mmi_sample_3dgame_entry_app_screen * DESCRIPTION * enter dev3dgame screen - init an MMI environment for 3D game * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_sample_3dgame_entry_app_screen(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ PU8 gui_buffer; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ EntryNewScreen(SCR_ID_3D_GAME, mmi_sample_3dgame_exit_app_screen, mmi_sample_3dgame_entry_app_screen, NULL); gui_buffer = GetCurrGuiBuffer(SCR_ID_3D_GAME); /* reset clip */ gdi_layer_reset_clip(); gdi_layer_reset_text_clip(); /* enable multilayer */ gdi_layer_multi_layer_enable(); /* entry full screen app - will force status bar update */ entry_full_screen(); /* force all playing keypad tone off */ mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED); /* set audio volumn */ mdi_audio_set_volume(MDI_VOLUME_MEDIA, 4); /* vol level : 0 - 6 */ /* suspend background play */ mdi_audio_suspend_background_play(); /* stop MMI sleep */ TurnOnBacklight(0); /* clear keys */ ClearInputEventHandler(MMI_DEVICE_ALL); clear_category_screen_key_handlers(); /* set RSK-up to exit */ SetKeyHandler(GoBackHistory, KEY_RSK, KEY_EVENT_UP); /* clear background as black */ gdi_layer_clear(GDI_COLOR_BLACK); gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1); #ifndef WIN32 /* enable faster key handling */ mmi_frm_set_key_handle_in_high_frequency(MMI_TRUE); #endif /* WIN32 */ #ifdef __MMI_SUBLCD__ /* draw game icon on sublcd */ ForceSubLCDScreen(mmi_sample_3dgame_entry_sublcd); #endif /* __MMI_SUBLCD__ */ /* disalbe align timer, this will let timer more accurate */ UI_disable_alignment_timers(); /* start game */ if (gui_buffer == NULL) { /* TODO: start new game here .. */ } else { /* back from interrupt */ /* TODO: resume a existing game here .. */ } }