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

📄 mainlcd.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *  mainlcd.c
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *  define LCD and sub-LCD routines.
 *
 * Author:
 * -------
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
#ifndef _MAINLCD_C
#define _MAINLCD_C
#include "mmi_features.h"
#include "kal_non_specific_general_types.h"
#include "gui.h"

/* target    : custom/drv/LCD/XXXXLCM/lcd_sw_inc.h */
/* simulator : plutommi/mmi/DrvSim/DrvSimInc/lcd_sw_inc.h */
#include "lcd_sw.h"

/* interface/Include/lcd_if.h */
#include "lcd_if.h"
#include "gdi_include.h"
#include "KeyMap.h"
#include "lcd_sw_rnd.h"

/***************************************************************************** 
* Define
*****************************************************************************/
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */ 

#define SIMULATOR_LAYER_COUNT       (4)

#define  BUF_PIXEL_DATA(buff_ptr,x , y, width)  (*(buff_ptr + ((y) * width + (x))))
#define  RGB_TO_HW(R, G, B)                     ((((B) & 0xf8) >> 3) | (((G) & 0xfc) << 3) | (((R) & 0xf8) << 8))
#define  HW_TO_RGB_R(VALUE)                     ((U8)(((VALUE) & 0xf800) >> 8))
#define  HW_TO_RGB_G(VALUE)                     ((U8)(((VALUE) & 0x07e0) >> 3))
#define  HW_TO_RGB_B(VALUE)                     ((U8)(((VALUE) & 0x001f) << 3))

#define  LCD_LAYER0_ENABLE    0x80000000
#define  LCD_LAYER1_ENABLE    0x40000000
#define  LCD_LAYER2_ENABLE    0x20000000
#define  LCD_LAYER3_ENABLE    0x10000000

/***************************************************************************** 
* Typedef 
*****************************************************************************/
/* it must be identical to what was defined in MODIS_UI.h */
typedef struct
{
    unsigned int layer_enable;
    unsigned int frame_buffer_address;

    int text_clip_left;
    int text_clip_top;
    int text_clip_right;
    int text_clip_bottom;

    int gfx_clip_left;
    int gfx_clip_top;
    int gfx_clip_right;
    int gfx_clip_bottom;

    int active_layer;

    unsigned short layer_x_offset;
    unsigned short layer_y_offset;
    unsigned short layer_width;
    unsigned short layer_height;

    unsigned short roi_x_offset;
    unsigned short roi_y_offset;
    unsigned short roi_width;
    unsigned short roi_height;

    unsigned char source_key_enable;
    unsigned char opacity_enable;
    unsigned short source_key;
    unsigned char opacity_value;
} MODIS_UI_layer_info_struct;

/***************************************************************************** 
* Local Variable
*****************************************************************************/
/* Main LCD simulator shadow buffer */
U16 simulator_shadow_buffer[LCD_WIDTH * LCD_HEIGHT];

/* Sub LCD simulator shadow buffer */
#ifdef __MMI_SUBLCD__
U16 simulator_sub_shadow_buffer[SUBLCD_WIDTH * SUBLCD_HEIGHT];
#endif 

/* Main LCD frame buffer for bitmap */
unsigned int simulator_frame_buffer[LCD_WIDTH * LCD_HEIGHT];

#ifdef __MMI_SUBLCD__
/* Sub LCD frame buffer for bitmap */
unsigned int sub_simulator_frame_buffer[SUBLCD_WIDTH * SUBLCD_HEIGHT];
#endif /* __MMI_SUBLCD__ */ 

BITMAPINFO bitmap_info;
BITMAPINFO sub_bitmap_info;

T_W32_SCREEN_DEVICE *device;

U16 SIMULATOR_SKIN_LCD_X;
U16 SIMULATOR_SKIN_LCD_Y;
U16 SIMULATOR_SKIN_SUB_LCD_X;
U16 SIMULATOR_SKIN_SUB_LCD_Y;

#ifdef __MMI_SUBLCD__
kal_uint8 SubLCDSetArray[] = 
{
    0x01,   /* 0000 0001 */
    0x02,   /* 0000 0010 */
    0x04,   /* 0000 0100 */
    0x08,   /* 0000 1000 */
    0x10,   /* 0001 0000 */
    0x20,   /* 0010 0000 */
    0x40,   /* 0100 0000 */
    0x80    /* 1000 0000 */
};

kal_uint8 SubLCDReSetArray[] = 
{
    0xFE,   /* 1111 1110 */
    0xFD,   /* 1111 1101 */
    0xFB,   /* 1111 1011 */
    0xF7,   /* 1111 0111 */
    0xEF,   /* 1110 1111 */
    0xDF,   /* 1101 1111 */
    0xBF,   /* 1011 1111 */
    0x7F    /* 0111 1111 */
};
#endif /* __MMI_SUBLCD__ */ 

/* main window */
/* layer_sim_size    layer_sim_main_window; */

/* ROI */
/* layer_sim_offset  layer_sim_ROI_offset; */
/* layer_sim_size    layer_sim_ROI_size; /*
   
   /* layers */
lcd_layer_struct lcd_layer_data[SIMULATOR_LAYER_COUNT];

/* palette look up table */
U16 layer_sim_LUT0[256];
U16 layer_sim_LUT1[256];

BOOL IsLcdFirstInit = TRUE;

HDC hdcMem, hdc;

#ifdef __MMI_SUBLCD__
HDC sub_hdcMem;
HBITMAP sub_hbmp;
#endif /* __MMI_SUBLCD__ */ 
HBITMAP hbmp;

MODIS_UI_layer_info_struct MODIS_UI_layer[SIMULATOR_LAYER_COUNT];
MODIS_UI_layer_info_struct **MODIS_UI_layer_ptr;
MODIS_UI_layer_info_struct *uil_ptr;

unsigned char new_application_flag = 0;
S32 active_layer;

/***************************************************************************** 
* Local Function
*****************************************************************************/

/***************************************************************************** 
* Global Variable
*****************************************************************************/
extern HWND hWnd;

/***************************************************************************** 
* Global Function
*****************************************************************************/
extern T_W32_SCREEN_DEVICE *GetDeviceData();
extern __declspec(dllimport)
     void set_MODIS_UI_layer_data(MODIS_UI_layer_info_struct **layer,
                                  int lcd_width, int lcd_height, int layer_count, unsigned char *new_app_flag);


/*****************************************************************************
 * FUNCTION
 *  assert_lcd_fb_update
 * DESCRIPTION
 *  void
 * PARAMETERS
 *  lcd_id              [IN]        U8
 *  start_x             [IN]        U16
 *  start_y             [IN]        U16
 *  end_x               [IN]        U16
 *  end_y               [IN]        U16
 *  roi_offset_x        [IN]        U16
 *  roi_offset_y        [IN]        U16
 *  update_layer        [IN]        U32
 * RETURNS
 *  void
 *****************************************************************************/
     void assert_lcd_fb_update(
            kal_uint8 lcd_id,
            kal_uint16 start_x,
            kal_uint16 start_y,
            kal_uint16 end_x,
            kal_uint16 end_y,
            kal_uint16 roi_offset_x,
            kal_uint16 roi_offset_y,
            kal_uint32 update_layer)
{

    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
}   /* end of assert_lcd_fb_update */


/*****************************************************************************
 * FUNCTION
 *  reset_lcd_if
 * DESCRIPTION
 *  void
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void reset_lcd_if(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
}   /* end of reset_lcd_if */


/*****************************************************************************
 * FUNCTION
 *  config_lcd_layer_window
 * DESCRIPTION
 *  void
 * PARAMETERS
 *  lcd_layer       [IN]        Unsigned char
 *  layer_data      [IN]        Lcd_layer_struct
 * RETURNS
 * TRUE
 *****************************************************************************/
BOOL config_lcd_layer_window(unsigned char lcd_layer, lcd_layer_struct *layer_data)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    lcd_layer_data[lcd_layer] = *layer_data;

    return TRUE;
}   /* end of config_lcd_layer_window */


/*****************************************************************************
 * FUNCTION
 *  lcd_dspl_init
 * DESCRIPTION
 *  screen initialization
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void lcd_dspl_init()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MODIS_UI_layer_ptr =
        (MODIS_UI_layer_info_struct **) malloc(SIMULATOR_LAYER_COUNT * sizeof(MODIS_UI_layer_info_struct*));

    /* initialize pointer allocation for MODIS_UI_layer */
    for (i = 0; i < SIMULATOR_LAYER_COUNT; i++)
    {
        MODIS_UI_layer_ptr[i] = &MODIS_UI_layer[i];
    }

    /* initialize layout data */
    device = GetDeviceData();

⌨️ 快捷键说明

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