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

📄 gdi2.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
字号:
#include "winav.h"
#include "w99av.h"
#include "gdi.h"
#include "hal.h" // Brian1.24-3
#include "cc.h"
#include "ucode.h" //Kevin2.37, add

// Brian1.20, no Speaker Testm then this file is useless
#ifdef REMOVE_SETUP_ICON

BYTE code _bGDI2Dummy[]=
{
0
};

#else

#ifdef SUPPORT_GZIP_COMPRESSION // Brian1.24

WORD code _wSetupIcon[]=
{
#include "bmp/icon.txt"
};

#else
DWORD code _aIconLanguageNormal[]=
{
#include "bmp/LangNorm.txt"
};
DWORD code _aIconScreenNormal[]=
{
#include "bmp/ScrnNorm.txt"
};

DWORD code _aIconAudioNormal[]=
{
#include "bmp/AudiNorm.txt"
};


DWORD code _aIconCustomNormal[]=
{
#include "bmp/CustNorm.txt"
};


DWORD code _aIconExitNormal[]=
{
#include "bmp/ExitNorm.txt"
};
#endif // #ifdef SUPPORT_GZIP_COMPRESSION

GDI_REGION_INFO code __RegionList_2[NUMBER_OF_REGION] =    // declare the region list
{
                    {   // region ID 0
                        GDI_REGION_WIDTH, GDI_REGION_HEIGHT,        // width, height
                        2,              // 0: 4 colors, 1: 16 colors, 2: 256 colors
                        REGION_T_ADDR0+(GDI_REGION_WIDTH>>2)-4,  // region top field address in DRAM
                        REGION_B_ADDR0+(GDI_REGION_WIDTH>>2)-4  // region bottom field address in DRAM
                    },
                    {   // region ID 1
                        GDI_REGION_WIDTH, GDI_REGION_HEIGHT,        // width, height
                        2,              // 0: 4 colors, 1: 16 colors, 2: 256 colors
                        REGION_T_ADDR1+(GDI_REGION_WIDTH>>2)-4,  // region top field address in DRAM
                        REGION_B_ADDR1+(GDI_REGION_WIDTH>>2)-4  // region bottom field address in DRAM
                    },
                    {   // region ID 2, resource database
                        GDI_REGION_WIDTH, GDI_REGION_2_HEIGHT,        // width 640, height 200
                        2,              // 0: 4 colors, 1: 16 colors, 2: 256 colors
                        REGION_T_ADDR2+(GDI_REGION_WIDTH>>2)-4,  // region top field address in DRAM
                        REGION_B_ADDR2+(GDI_REGION_WIDTH>>2)-4  // region bottom field address in DRAM
                    },


};


extern DWORD    _dwGDITemp;
extern DWORD    _dwGDIHeaders[];
extern WORD     _wGDITemp;
extern BYTE     _bGDITemp;
extern DWORD    *_pdwGDIPTR;
// Brian1.24-3
extern  WORD    _wOSDTemp;
extern  BYTE    _bOSDTemp;
extern  BYTE    *_bpArray;
extern  BYTE    DATA    _bIdex;




#ifdef SUPPORT_GZIP_COMPRESSION
// Brian1.24-3
// ************************************************************************
//  Function    :   _UnzipSetupIcon
//  Description :       Fill Setup Icon data to DSP through IBFIFO
//  Arguments   :       none
//  Return      :       none
//  Side Effect :
// ************************************************************************
void _UnzipSetupIcon(void)
{
	//Kevin2.37, modify
	W99AV_FillDataToIABFIFO(_wSetupIcon[1], &_wSetupIcon[5]);
}
#endif // #ifdef SUPPORT_GZIP_COMPRESSION

//  *********************************************************************
//  Function    :   GDI_LoadBMP
//  Description :   This function load the BMP data from code array into BMP OSD region
//              :   the region is decided by the __bCurrentRegionId
//  Arguments   :   pParm: point to a Bitmap structure 
//                  The Bitmap data is generated by bmp2data tool
//  Return      :   None
//  Side Effect :
//  ** Note **  :   In order to speed up the load process and reduce the complexity
//              :   We have made the following assumption, and we must follow it.
//              :   [1] bitmap width is 4-pixel alignment
//              :   [2] bitmap height is even
//              :   [3] The destination X-coordinate must be 4-pixel alignment
//              :   [4] The destination Y-coordinate must be even
//  *********************************************************************

void GDI_LoadBMP_2(void) //(PARM_BMP *pParm)
{
#ifndef NO_GDI

    BYTE    bWidth; //, bHeight;

    if (__bCurrentRegionId >= NUMBER_OF_REGION) 
        return;


#ifdef SUPPORT_GZIP_COMPRESSION

    // _dwGDIHeaders[2] is the icon data start address

    W99AV_ReadDRAMData(_dwGDIHeaders[2]+2, &_dwGDITemp); // bmp width
    bWidth = _dwGDITemp >> 2;  // how many DWORD in one line


    _dwGDITemp = ((DWORD)(__GDIParm.u.BMP.wY/2)*__RegionList_2[__bCurrentRegionId].wWidth + __GDIParm.u.BMP.wX);
    // 256 color, one BYTE contains 1 pixel
    _dwGDITemp = _dwGDITemp >> 2; //Calculate which DRAM DWORD the pixel is located

    _dwGDIHeaders[0] = __RegionList_2[__bCurrentRegionId].dwTAddr+4+_dwGDITemp; // start point DWORD in Top
    _dwGDIHeaders[1] = __RegionList_2[__bCurrentRegionId].dwBAddr+4+_dwGDITemp; // start point DWORD in Bottom
    _wGDITemp = (WORD)(__RegionList_2[__bCurrentRegionId].wWidth >> 2);    // Line offset in DWORD

    _dwGDITemp = _dwGDIHeaders[2]+4; // the actual data address (skip the 4 DW header)

    W99AV_ReadDRAMData(_dwGDIHeaders[2]+3, &_dwGDIHeaders[3]); // the height: Top+Bottom

    for (_bGDITemp=0; _bGDITemp < _dwGDIHeaders[3]/2; _bGDITemp++)
    {
        
        __dwW99AV_SrcDRAM = _dwGDITemp;
        __dwW99AV_DestDRAM = _dwGDIHeaders[0]+ (DWORD)_bGDITemp*_wGDITemp;
        W99AV_DRAMCopy(bWidth);  
        _dwGDITemp += bWidth;

        __dwW99AV_SrcDRAM = _dwGDITemp;
        __dwW99AV_DestDRAM = _dwGDIHeaders[1]+ (DWORD)_bGDITemp*_wGDITemp;
        W99AV_DRAMCopy(bWidth);  
        _dwGDITemp += bWidth;
        
    }

    _dwGDIHeaders[2] = _dwGDITemp; // update for the next icon data start address

#else // #ifdef SUPPORT_GZIP_COMPRESSION

    bWidth = (WORD)__GDIParm.u.BMP.pdwData[2] >> 2;  // how many DWORD in one line
    //bHeight = (WORD)pParm->pdwData[3];      // the height: Top+Bottom


    _dwGDITemp = ((DWORD)(__GDIParm.u.BMP.wY/2)*__RegionList_2[__bCurrentRegionId].wWidth + __GDIParm.u.BMP.wX);
    // 256 color, one BYTE contains 1 pixel
    _dwGDITemp = _dwGDITemp >> 2; //Calculate which DRAM DWORD the pixel is located

    _dwGDIHeaders[0] = __RegionList_2[__bCurrentRegionId].dwTAddr+4+_dwGDITemp; // start point DWORD in Top
    _dwGDIHeaders[1] = __RegionList_2[__bCurrentRegionId].dwBAddr+4+_dwGDITemp; // start point DWORD in Bottom
    _wGDITemp = (WORD)(__RegionList_2[__bCurrentRegionId].wWidth >> 2);    // Line offset in DWORD

    _pdwGDIPTR = &(__GDIParm.u.BMP.pdwData[4]);

    for (_bGDITemp=0; _bGDITemp < __GDIParm.u.BMP.pdwData[3]/2; _bGDITemp++)
    {
        // We can directly access the data by indexing into the position we want
        //W99AV_WriteDRAMBurst(_dwGDIHeaders[0]+ (DWORD)_bGDITemp*_wGDITemp, &(__GDIParm.u.BMP.pdwData[4+ ( (DWORD)(_bGDITemp) <<1) *bWidth]), bWidth);
        //W99AV_WriteDRAMBurst(_dwGDIHeaders[1]+ (DWORD)_bGDITemp*_wGDITemp, &(__GDIParm.u.BMP.pdwData[4+ ( ((DWORD)(_bGDITemp)<<1)+1) *bWidth]), bWidth);
        
        // or use ptr and increment
        W99AV_WriteDRAMBurst(_dwGDIHeaders[0]+ (DWORD)_bGDITemp*_wGDITemp, _pdwGDIPTR, bWidth);
        _pdwGDIPTR += bWidth;
        W99AV_WriteDRAMBurst(_dwGDIHeaders[1]+ (DWORD)_bGDITemp*_wGDITemp, _pdwGDIPTR, bWidth);
        _pdwGDIPTR += bWidth;
        
    }

#endif // #ifdef SUPPORT_GZIP_COMPRESSION

#endif  //#ifndef NO_GDI
}


//  *********************************************************************
//  Function    :   GDI_LoadBMPResource_1
//  Description :   This function loads the speaker BMP to DRAM
//  Arguments   :   none 
//  Return      :   none  
//  Side Effect : 
//  *********************************************************************
void GDI_LoadBMPResource_2(void)
{
#ifndef NO_GDI

    // BMP resource is put in region 2
    GDI_SET_CURRENT_REGION(2);

    // each icon has only one BMP, 
    // normal/over/down state is implemented by changing the background color of the icon

    // icon size is 60x44, five icons occupy the region (0, 0) ~ (299, 43)
/*
    __GDIParm.u.BMP.pdwData = _aIconLanguageNormal;
    __GDIParm.u.BMP.wX = 0;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();


    __GDIParm.u.BMP.pdwData = _aIconScreenNormal;
    __GDIParm.u.BMP.wX = 60;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

    __GDIParm.u.BMP.pdwData = _aIconAudioNormal;
    __GDIParm.u.BMP.wX = 120;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

    __GDIParm.u.BMP.pdwData = _aIconCustomNormal;
    __GDIParm.u.BMP.wX = 180;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

    __GDIParm.u.BMP.pdwData = _aIconExitNormal;
    __GDIParm.u.BMP.wX = 240;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();
*/

    // Brian1.22, re-arrange to reserve 4.25K DW for F/W user data

    // icon size is 60x44, five icons occupy the region (220, 0) ~ (519, 43)

#ifdef SUPPORT_GZIP_COMPRESSION
    
    // Set DM[0x0], destination address of Uzip data, to inform DSP.
    // *** use Font table area as temp unzip buffer, ==> so must unzip Setup icon before unzip Font table

	//Kevin2.37, modify
    //_UnzipSetupIcon();
	UCODE_Unzip(SETUPICON);


    _dwGDIHeaders[2] = OSD_DRAM_FONT_TABLE_START_0; // The address of icon data in SDRAM 

#else
    __GDIParm.u.BMP.pdwData = _aIconLanguageNormal;
#endif

    __GDIParm.u.BMP.wX = 220;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

#ifndef SUPPORT_GZIP_COMPRESSION
    __GDIParm.u.BMP.pdwData = _aIconScreenNormal;
#endif 
    __GDIParm.u.BMP.wX = 280;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

#ifndef SUPPORT_GZIP_COMPRESSION
    __GDIParm.u.BMP.pdwData = _aIconAudioNormal;
#endif
    __GDIParm.u.BMP.wX = 340;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

#ifndef SUPPORT_GZIP_COMPRESSION
    __GDIParm.u.BMP.pdwData = _aIconCustomNormal;
#endif
    __GDIParm.u.BMP.wX = 400;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();

#ifndef SUPPORT_GZIP_COMPRESSION
    __GDIParm.u.BMP.pdwData = _aIconExitNormal;
#endif
    __GDIParm.u.BMP.wX = 460;
    __GDIParm.u.BMP.wY = 0;
    GDI_LoadBMP_2();


#endif
}





#endif // #ifdef REMOVE_SETUP_ICON

⌨️ 快捷键说明

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