Locate the coordinates of categories and categories in MTK.

Source: Internet
Author: User

// The algorithm used to search for categories in MTK, and finally obtain the array value corresponding to g_categories_controls_map.

U8 * dm_search_control_set (s32 category_id, S16 ** default_coordinate_set_p) <br/> {<br/>/* variable */<br/>/* local variables */<br/>/* variable */<br/> u8 min = 0, max = 0, mid = 0; <br/>/* ---------------------------------------------------------------- */<br/>/* Code body */<br/> /* Optional */<br/>/* mmi_assert (category_id); */<br/> If (category_id = 0) <br/>{< br/> return NULL; <br/>}< br/> max = dm_get_control_sets_count (); <br/>/* Set max as Max number of records */<br/> min = 0; <br/> * default_coordinate_set_p = NULL; <br/> while (Min <= max) <br/>{< br/> mid = (MAX + min)> 1; <br/> If (g_categories_contro Ls_map [Mid]. category_id = (2010) category_id) <br/>{< br/> # ifdef _ mmi_screen_rotate __< br/> mmi_dbg_assert (! Mmi_frm_is_screen_width_height_swapped () | <br/> g_categories_controls_map [Mid]. rotated_coordinate_set_p); <br/> If (mmi_frm_is_screen_width_height_swapped () & g_categories_controls_map [Mid]. rotated_coordinate_set_p) <br/>{< br/> * default_coordinate_set_p = g_categories_controls_map [Mid]. rotated_coordinate_set_p; <br/>}< br/> else <br/>{< br/> * default_coordinate_set_p = g_categories_controls_map [Mid]. default_coordinate_set_p; <br/>}< br/> # else/* _ mmi_screen_rotate _ */<br/> * default_coordinate_set_p = g_categories_controls_map [Mid]. default_coordinate_set_p; <br/> # endif/* _ mmi_screen_rotate _ */<br/> return g_categories_controls_map [Mid]. control_set_p; <br/>}< br/> else if (g_categories_controls_map [Mid]. category_id> (2010) category_id) <br/>{< br/> max = mid-1; <br/>}< br/> else <br/>{< br/> min = Mid + 1; <br/>}< br/> mmi_assert (0); <br/> return NULL; <br/>}/ * end of dm_search_control_set */ 

 

// Set coordinate_set for the coordinates of categories, which is the same as the search method in the preceding section.

<Br/> S16 * dm_search_coordinate_set (s32 scrid) <br/> {<br/>/* variable */<br/>/* local variables */<br/>/* variable */<br/> s32 startindex = 0; <br/> s32 endindex = dm_get_coordinate_sets_count (); <br/>/* response */<br/>/* Code body */<br/>/* response */<br/> while (endindex> = startindex) <br/> {<br/> s32 middleindex = (endindex + startindex)> 1; <br/> If (g_screenid_coordinate_sets_map [middleindex]. screen_id = scrid) <br/>{< br/> return g_screenid_coordinate_sets_map [middleindex]. coordinate_set_p; <br/>}< br/> else if (g_screenid_coordinate_sets_map [middleindex]. screen_id> scrid) <br/>{< br/> endindex = middleindex-1; <br/>}< br/> else <br/> {<br/> startindex = middleindex + 1; <br/>}< br/> return NULL; <br/>}/ * end of dm_search_coordinate_set */<br/> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.