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

📄 gdi1.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
字号:
#include "winav.h"
#include "w99av.h"
#include "gdi.h"

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

BYTE code _bGDI1Dummy[]=
{
0
};

#else

DWORD code _aImageSpeaker[]=
{
#include "bmp/speaker.txt"
};

GDI_REGION_INFO code __RegionList_1[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;

//  *********************************************************************
//  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_1(void) //(PARM_BMP *pParm)
{
#ifndef NO_GDI

    BYTE    bWidth; //, bHeight;

    if (__bCurrentRegionId >= NUMBER_OF_REGION) 
        return;

    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_1[__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_1[__bCurrentRegionId].dwTAddr+4+_dwGDITemp; // start point DWORD in Top
    _dwGDIHeaders[1] = __RegionList_1[__bCurrentRegionId].dwBAddr+4+_dwGDITemp; // start point DWORD in Bottom
    _wGDITemp = (WORD)(__RegionList_1[__bCurrentRegionId].wWidth >> 2);    // Line offset in DWORD

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

    //_printf("region 2 dwTAddr = %lx\n", __RegionList[2].dwTAddr);
    //_printf("region 2 dwBAddr = %lx\n", __RegionList[2].dwBAddr);

    //_printf("_dwGDIHeaders[0] = %lx\n", _dwGDIHeaders[0]);
    //_printf("_dwGDIHeaders[1] = %lx\n", _dwGDIHeaders[1]);

    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, &(pParm->pdwData[4+ ( (DWORD)(_bGDITemp) <<1) *bWidth]), bWidth);
        //W99AV_WriteDRAMBurst(_dwGDIHeaders[1]+ (DWORD)_bGDITemp*_wGDITemp, &(pParm->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;

        //_printf("%hx Top = %lx\n", _bGDITemp, _dwGDIHeaders[0]+ (DWORD)_bGDITemp*_wGDITemp);
        //_printf("%hx Bot = %lx\n", _bGDITemp, _dwGDIHeaders[1]+ (DWORD)_bGDITemp*_wGDITemp);

    }

#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_1(void)
{
#ifndef NO_GDI

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

    //Speaker image
/*
    __GDIParm.u.BMP.pdwData = _aImageSpeaker;
    __GDIParm.u.BMP.wX = 0;
    __GDIParm.u.BMP.wY = 44;
*/

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

    // image size is 220x132, occupy the region (0, 0) ~ (219, 131)

    __GDIParm.u.BMP.pdwData = _aImageSpeaker;
    __GDIParm.u.BMP.wX = 0;
    __GDIParm.u.BMP.wY = 0;

    GDI_LoadBMP_1();


#endif
}

#endif // #ifndef REMOVE_SETUP_SPEAKER_TEST

⌨️ 快捷键说明

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