⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wgui_draw_manager.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    RedrawCategoryFunction = redraw_function;
    GetCategoryHistory = get_history_function;
    GetCategoryHistorySize = get_history_size_function;
}

#ifdef __MMI_SUBLCD__


/*****************************************************************************
 * FUNCTION
 *  dm_sublcd_setup_data
 * DESCRIPTION
 *  This function sets up the information for the Sublcd Draw Manager
 * PARAMETERS
 *  dm_data     [IN]        Which contains the Draw Manager Information
 * RETURNS
 *  void
 *****************************************************************************/
void dm_sublcd_setup_data(dm_data_struct *dm_data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_dm_sublcd_data.s32CatId = dm_data->s32CatId;
    g_dm_sublcd_data.s32ScrId = dm_data->s32ScrId;
    g_dm_sublcd_data.s32flags = dm_data->s32flags;
    dm_sub_backup_current_category_exit_function();
    if (g_dm_sublcd_data.s32CatId == 0 && g_dm_sublcd_data.s32ScrId == 0 && g_dm_sublcd_data.s32flags == 0)
    {
        return;
    }

    if (g_dm_sublcd_data.s32flags & DM_SUB_LCD_CONTEXT)
    {
        /* Normal procedure */
        if (g_dm_cntx.redraw_screen_sub == NORMAL_EXIT)
        {
            g_dm_cntx.redraw_screen_sub = NORMAL_SHOW;
        }

        /* from redraw screen */
        else if (g_dm_cntx.redraw_screen_sub == NORMAL_REDRAW)
        {
            g_dm_cntx.redraw_screen_sub = NORMAL_REDRAW;
            /* MMI_ASSERT (0); */
        }

        /* from show screen */
        //              else if ( g_dm_cntx.redraw_screen_sub == NORMAL_SHOW )
        //                      MMI_ASSERT (0);
    }
}   /* end of dm_setup_data */


/*****************************************************************************
 * FUNCTION
 *  dm_sublcd_redraw_category_screen
 * DESCRIPTION
 *  This function redraws the Sublcd.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void dm_sublcd_redraw_category_screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct g_dm_data_temp_struct;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_set_sub_LCD_graphics_context();
    g_dm_data_temp_struct = g_dm_data;
    g_dm_data = g_dm_sublcd_data;
    g_dm_data.s32flags |= DM_SUB_LCD_CONTEXT;
    dm_redraw_category_screen();
    g_dm_data = g_dm_data_temp_struct;
    UI_set_main_LCD_graphics_context();
}   /* end of dm_setup_data */
#endif /* __MMI_SUBLCD__ */ 


/*****************************************************************************
 * FUNCTION
 *  dm_is_activated
 * DESCRIPTION
 *  Check whether the current
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
MMI_BOOL dm_is_activated(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_dm_data.s32CatId == 0)
    {
        return MMI_FALSE;
    }
    else
    {
        return MMI_TRUE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  dm_setup_data
 * DESCRIPTION
 *  This function sets up the information for the Draw Manager
 * PARAMETERS
 *  dm_data     [IN]        Which contains the Draw Manager Information
 * RETURNS
 *  void
 *****************************************************************************/
void dm_setup_data(dm_data_struct *dm_data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_dm_data.s32CatId = dm_data->s32CatId;
    g_dm_data.s32ScrId = dm_data->s32ScrId;
    g_dm_data.s32flags = dm_data->s32flags;

    dm_backup_current_category_exit_function();

    if (g_dm_data.s32CatId == 0 && g_dm_data.s32ScrId == 0 && g_dm_data.s32flags == 0)
    {
        return;
    }

    /* Normal procedure */
    if (g_dm_cntx.redraw_screen_main == NORMAL_EXIT)
    {
        g_dm_cntx.redraw_screen_main = NORMAL_SHOW;
    }

    /* from redraw screen */
    else if (g_dm_cntx.redraw_screen_main == NORMAL_REDRAW)
    {
        g_dm_cntx.redraw_screen_main = REDRAW_2_SHOW;
        dm_reset_context();
        g_dm_cntx.redraw_screen_main = NORMAL_SHOW;
        /* MMI_ASSERT (0); */
    }

    /* from show screen */
    else if (g_dm_cntx.redraw_screen_main == NORMAL_SHOW)
    {
        ;
    }
    /* MMI_ASSERT (0); */

#ifdef __MMI_SCREEN_ROTATE__

    if (mmi_frm_is_screen_width_height_swapped())
    {
        /* Close status icon (but not entry_full_screen()) */
        close_title_status_icon();
        g_dm_cntx.exit_full_screen_on_exit = MMI_TRUE;
        /* Set screen background */
        g_dm_data.s32flags |= DM_CLEAR_SCREEN_BACKGROUND;

        /* Keep draw manager opacity context unchanged */
        dm_set_scr_bg_image(IMG_SCREEN_ROTATE_BACKGROUND, NULL, -1, -1, g_dm_scr_bg_cntx.layer_opacity);
    }
#endif /* __MMI_SCREEN_ROTATE__ */ 

}   /* end of dm_setup_data */


/*****************************************************************************
 * FUNCTION
 *  dm_search_coordinate_set
 * DESCRIPTION
 *  This function is used to search (binary search) the coordinate set corresponding to the passed Screen Id.
 * PARAMETERS
 *  ScrId           [IN]        
 *  s32ScrId(?)     [IN]        Screen Id corresponding to which coordinate set is to be obtained.
 * RETURNS
 *  void
 *****************************************************************************/
S16 *dm_search_coordinate_set(S32 ScrId)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 StartIndex = 0;
    S32 EndIndex = dm_get_coordinate_sets_count();

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while (EndIndex >= StartIndex)
    {
        S32 MiddleIndex = (EndIndex + StartIndex) >> 1;

        if (g_screenid_coordinate_sets_map[MiddleIndex].screen_id == ScrId)
        {
            return g_screenid_coordinate_sets_map[MiddleIndex].coordinate_set_p;
        }
        else if (g_screenid_coordinate_sets_map[MiddleIndex].screen_id > ScrId)
        {
            EndIndex = MiddleIndex - 1;
        }
        else
        {
            StartIndex = MiddleIndex + 1;
        }
    }
    return NULL;
}   /* end of dm_search_coordinate_set */


/*****************************************************************************
 * FUNCTION
 *  dm_search_control_set
 * DESCRIPTION
 *  get control set address by category id
 * PARAMETERS
 *  category_id                     [IN]        Id of category screen
 *  default_coordinate_set_p        [IN]        
 * RETURNS
 *  U8 address of corresponding control set
 *****************************************************************************/
U8 *dm_search_control_set(S32 category_id, S16 **default_coordinate_set_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 min = 0, max = 0, mid = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* MMI_ASSERT(category_id); */
    if (category_id == 0)
    {
        return NULL;
    }

    max = dm_get_control_sets_count();
    /* set max as max number of records */
    min = 0;
    *default_coordinate_set_p = NULL;
    while (min <= max)
    {
        mid = (max + min) >> 1;
        if (g_categories_controls_map[mid].category_id == (U16) category_id)
        {
        #ifdef __MMI_SCREEN_ROTATE__
            MMI_DBG_ASSERT(!mmi_frm_is_screen_width_height_swapped() ||
                           g_categories_controls_map[mid].rotated_coordinate_set_p);
            if (mmi_frm_is_screen_width_height_swapped() && g_categories_controls_map[mid].rotated_coordinate_set_p)
            {
                *default_coordinate_set_p = g_categories_controls_map[mid].rotated_coordinate_set_p;
            }
            else
            {
                *default_coordinate_set_p = g_categories_controls_map[mid].default_coordinate_set_p;
            }
        #else /* __MMI_SCREEN_ROTATE__ */ 
            *default_coordinate_set_p = g_categories_controls_map[mid].default_coordinate_set_p;
        #endif /* __MMI_SCREEN_ROTATE__ */ 
            return g_categories_controls_map[mid].control_set_p;
        }
        else if (g_categories_controls_map[mid].category_id > (U16) category_id)
        {
            max = mid - 1;
        }
        else
        {
            min = mid + 1;
        }
    }
    MMI_ASSERT(0);
    return NULL;
}   /* end of dm_search_control_set */


/*****************************************************************************
 * FUNCTION
 *  dm_setup_base_layer
 * DESCRIPTION
 *  This function is used setup the base layer
 * PARAMETERS
 *  void
 *  *(?)
 * RETURNS
 *  void
 *****************************************************************************/
S32 dm_setup_base_layer(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    GDI_HANDLE act_lcd_handle;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_lcd_get_active(&act_lcd_handle);
    if (act_lcd_handle == GDI_LCD_SUB_LCD_HANDLE && !(g_dm_data.s32flags & DM_SUB_LCD_CONTEXT))
    {
        MMI_ASSERT(0);
    }

#ifdef __MMI_SUBLCD__
    if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
    {
        gdi_layer_get_base_handle(&dm_layers_sub[dm_layers_count_sub++]);
    }
    else
#endif /* __MMI_SUBLCD__ */ 
        gdi_layer_get_base_handle(&dm_layers[dm_layers_count++]);

    gdi_layer_restore_base_active();
    /* not to set source key when sublcd is b/w */
#if (defined __MMI_SUBLCD__) && (!defined __MMI_SUBLCD_COLOR__)
    if ( act_lcd_handle == GDI_LCD_SUB_LCD_HANDLE )
    {
        gdi_layer_set_source_key(FALSE,0);
    }
    else
    {
        gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
    }
#else
    gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
#endif

#ifndef __GDI_MEMORY_PROFILE_2__
    new_layer_x = 0;
    new_layer_y = 0;
#endif /* __GDI_MEMORY_PROFILE_2__ */ 
    return 1;
}


/*****************************************************************************
 * FUNCTION
 *  dm_setup_new_layer
 * DESCRIPTION
 *  This function is used setup a new layer
 * PARAMETERS
 *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
 *  *(?)
 * RETURNS
 *  void
 *****************************************************************************/
S32 dm_setup_new_layer(S16 **UICtrlAccessPtr_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_coordinates dm_layer_info;
    gdi_result ret;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __GDI_MEMORY_PROFILE_2__
    gdi_layer_multi_layer_enable();
#endif 

    *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_layer_info);
    /* need to take care in REDRAW_2_REDRAW */
    if (g_dm_cntx.redraw_screen_main == REDRAW_2_REDRAW)
    {
        return 1;
    }

    if (dm_layer_info.s16X == -1 && dm_layer_info.s16Y == -1 && dm_layer_info.s16Width == -1 &&
        dm_layer_info.s16Height == -1)
    {
        return 1;
    }

#ifdef __GDI_MEMORY_PROFILE_2__ /* Multi-layer enable */

#ifdef __MMI_SUBLCD__

    if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
    {
        ret = gdi_layer_create(
                dm_layer_info.s16X,
                dm_layer_info.s16Y,
                dm_layer_info.s16Width,
                dm_layer_info.s16Height,
                &dm_layers_sub[dm_layers_count_sub]);
        MMI_ASSERT(ret >= 0);
        gdi_layer_set_active(dm_layers_sub[dm_layers_count_sub]);
        dm_layers_count_sub++;
    }
    else
#endif /* __MMI_SUBLCD__ */ 

    {
        ret = gdi_layer_create(
                dm_layer_info.s16X,
                dm_layer_info.s16Y,
                dm_layer_info.s16Width,
                dm_layer_info.s16Height,
                &dm_layers[dm_layers_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -