?? gdi.c
字號(hào):
//printf("start:%d ", wCnt);
for (j=0; j<bStrLen; j++)
{
bWidth = ((__wGDIString[j+1] & 0xF000) >> 10); // get width ( >> 12 * 4)
for (k=0; k<bWidth; k++) // if variable sized font, the width depends on each char
//for (k=bWidth; k>0; k--)
{
switch (bMode)
{
case 0:
break;
case 1:
break;
case 2:
bTemp1 = _GetFontBit2(__wGDIString[j+1], k, i);
switch(bTemp1)
{
case 0:
*pbBuffer++ = __bTextBgColor;
break;
case 1:
*pbBuffer++ = __bTextFgColor;
break;
case 2:
*pbBuffer++ = __bShadowColor_1;
break;
case 3:
*pbBuffer++ = __bShadowColor_2;
break;
}
break;
}
wCnt++;
}
}
//printf("mid:%d ", wCnt);
// check if we need to read back the pixels (1, 2, 3) from DRAM
bTemp1 = (BYTE)((__wGDIx + wCnt - m) % (1L << (4-bMode)));
if (bTemp1)
{
// read back the DWORD where the end point is in
W99AV_ReadDRAMData( _dwGDIHeaders[0] + (wCnt >> (4 - bMode)), &_dwGDIHeaders[1] );
#if IO == IO_PCI
Swap((BYTE*)&_dwGDIHeaders[1]);
#endif
// also put the other pixels in the buffer
for (m=0; m<(1L << (4-bMode))-bTemp1; m++)
{
switch (bMode)
{
case 0:
break;
case 1:
//_Get4Bits( ((BYTE *)&_dwGDIHeaders[1]) + (bTemp1 + m)/2, wCnt%2, &j);
//_Put4Bits(pbBuffer, wCnt%2, j);
//if (wCnt%2)
// pbBuffer++;
break;
case 2:
*pbBuffer++ = *((BYTE*) (&_dwGDIHeaders[1]) + bTemp1 + m);
break;
}
wCnt++;
}
}
//if ((__wGDIy + i) % 2) // check whether the line is in top or bottom field
// _dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwBAddr+4+_dwGDITemp + ((DWORD)i*__RegionList[__bCurrentRegionId].wWidth>>2);
//else
// _dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwTAddr+4+_dwGDITemp + ((DWORD)i*__RegionList[__bCurrentRegionId].wWidth>>2);
// output one line to DRAM with burst write, each time 14 DWORD
pbBuffer = __bPixelBuffer;
//printf("end:%d\n", wCnt);
wCnt = wCnt >> (4 - bMode);
#if IO == IO_PCI
for (m=0; m<wCnt; m++)
Swap(pbBuffer+m*4);
#endif
//pbBuffer[3] = 5;
//pbBuffer[2] = 5;
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, wCnt);
/*
for (m=0; m<wCnt/14; m++)
{
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, 14);
pbBuffer = pbBuffer + 56; // 56 => 14 * 4
_dwGDIHeaders[0] = _dwGDIHeaders[0] + 14;
}
if (wCnt % 14)
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, wCnt % 14);
*/
}
#endif //#ifndef GDI_EMULATION
#endif //#ifndef NO_GDI
}
#ifdef SUPPORT_UNICODE
// Alan2.36 adds the following function
// *********************************************************************
// Function : GDI_DrawUnicodeString
// Description : This function output the unicode text
// Arguments : wMaxWidth : The maximum width of the string can be drawn.
// The rest string will not be drawn.
// If set to 0, it means to draw the whole the string.
// Global Var : __wGDIString[]: the array stores the char index
// __wGDIx, __wGDIy: the start point(x, y)
// Return : none
// Side Effect :
// *********************************************************************
void GDI_DrawUnicodeString(WORD wMaxWidth) //WORD wX, WORD wY)
{
#ifndef NO_GDI
GDI_DrawUnicodeString_GXA(wMaxWidth);
return;
#endif //#ifndef NO_GDI
}
// *********************************************************************
// Function : GDI_DrawAsciiString
// Description : This function output the ascii text
// Arguments : wMaxWidth : The maximum width of the string can be drawn
// The rest string will not be drawn.
// If set to 0, it means to draw the whole the string
// Global Var : __wGDIString[]: the array stores the char index
// __wGDIx, __wGDIy: the start point(x, y)
// Return : none
// Side Effect :
// *********************************************************************
void GDI_DrawAsciiString(WORD wMaxWidth)
{
#ifndef NO_GDI
GDI_DrawAsciiString_GXA(wMaxWidth);
return;
#endif //#ifndef NO_GDI
}
#endif
// *********************************************************************
// Function : GDI_FillRect
// Description : This function fills the rectangle
// Arguments : pParm points to the PARM_RECT
// Return : none
// Side Effect :
// Note :
// *********************************************************************
void GDI_FillRect(PARM_RECT *pParm)
{
#ifndef NO_GDI
#ifndef GDI_EMULATION
if (__bCurrentRegionId >= NUMBER_OF_REGION)
return;
if (pParm->rect.wLeft >= __RegionList[__bCurrentRegionId].wWidth ||
// Brian1.08, don't check height, so region 0 can do "Off Screen"
//pParm->rect.wTop >= __RegionList[__bCurrentRegionId].wHeight ||
pParm->rect.wLeft > pParm->rect.wRight ||
pParm->rect.wTop > pParm->rect.wBottom)
return; // the position is not in the area
if (pParm->rect.wRight >= __RegionList[__bCurrentRegionId].wWidth)
pParm->rect.wRight = (WORD)__RegionList[__bCurrentRegionId].wWidth-1;
// Brian1.08, don't check height, so region 0 can do "Off Screen"
//if (pParm->rect.wBottom >= __RegionList[__bCurrentRegionId].wHeight)
// pParm->rect.wBottom = (WORD)__RegionList[__bCurrentRegionId].wHeight-1;
if (pParm->rect.wRight == pParm->rect.wLeft) // Brian1.22, width need to be 2n, doesn't support 1-pixel width
return;
GDI_FillRect_GXA(pParm);
#else
BYTE m, bTemp, bTemp1;
WORD i, k, bWidth, bHeight;
BYTE *pbBuffer;
WORD wCnt;
BYTE bMode;
if (__bCurrentRegionId >= NUMBER_OF_REGION)
return;
if (pParm->rect.wLeft >= __RegionList[__bCurrentRegionId].wWidth ||
pParm->rect.wTop >= __RegionList[__bCurrentRegionId].wHeight ||
pParm->rect.wLeft > pParm->rect.wRight ||
pParm->rect.wTop > pParm->rect.wBottom)
return; // the position is not in the area
if (pParm->rect.wRight >= __RegionList[__bCurrentRegionId].wWidth)
pParm->rect.wRight = (WORD)__RegionList[__bCurrentRegionId].wWidth-1;
if (pParm->rect.wBottom >= __RegionList[__bCurrentRegionId].wHeight)
pParm->rect.wBottom = (WORD)__RegionList[__bCurrentRegionId].wHeight-1;
GDI_FillRect_GXA(pParm);
return;
bWidth = pParm->rect.wRight - pParm->rect.wLeft + 1;
bHeight = pParm->rect.wBottom - pParm->rect.wTop + 1;
bMode = __RegionList[__bCurrentRegionId].bColorMode;
_dwGDITemp = ((DWORD)(pParm->rect.wTop/2)*__RegionList[__bCurrentRegionId].wWidth + pParm->rect.wLeft);
// 256 color, one BYTE contains 1 pixel
bTemp = (BYTE)(_dwGDITemp% (1L << (4-bMode)));
_dwGDITemp = _dwGDITemp >> (4 - bMode) ; //Calculate which DRAM DWORD the pixel is located
for (i=0; i<bHeight; i++)
{
// check whether the line is in top or bottom field
// _dwGDIHeaders[0] contains the starting DWORD in DRAM for each line
if ((pParm->rect.wTop + i) % 2)
_dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwBAddr+4+_dwGDITemp + ((DWORD)(i/2)*__RegionList[__bCurrentRegionId].wWidth>> (4 - bMode));
else
{
if (pParm->rect.wTop%2)
_dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwTAddr+4+_dwGDITemp + ((DWORD)((i/2)+1)*__RegionList[__bCurrentRegionId].wWidth>> (4 - bMode));
else
_dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwTAddr+4+_dwGDITemp + ((DWORD)(i/2)*__RegionList[__bCurrentRegionId].wWidth>> (4 - bMode));
}
wCnt = 0;
pbBuffer = __bPixelBuffer;
m=0;
if (bTemp) // the starting point is not on the DWORD bundary, so must read back the pixels (0, 1, 2) before it
{
W99AV_ReadDRAMData( _dwGDIHeaders[0], &_dwGDIHeaders[1] );
#if IO == IO_PCI
Swap((BYTE*)&_dwGDIHeaders[1]);
#endif
for (m=0; m<bTemp; m++)
{
switch (bMode)
{
case 0:
break;
case 1:
//_Get4Bits( ((BYTE *)&_dwGDIHeaders[1]) + m/2, wCnt%2, &bTemp1);
//_Put4Bits(pbBuffer, wCnt%2, bTemp1);
//if (wCnt%2)
// pbBuffer++;
break;
case 2:
*pbBuffer++ = *((BYTE*) (&_dwGDIHeaders[1]) + m);
break;
}
wCnt++;
}
}
//printf("start:%d ", wCnt);
//for (j=0; j<bStrLen; j++)
{
for (k=0; k<bWidth; k++) // if variable sized font, the width depends on each char
//for (k=bWidth; k>0; k--)
{
switch (bMode)
{
case 0:
break;
case 1:
//_Put4Bits(pbBuffer, wCnt%2, bColor);
//if (wCnt%2)
// pbBuffer++;
break;
case 2:
*pbBuffer++ = pParm->bColor;
break;
}
wCnt++;
}
}
//printf("mid:%d ", wCnt);
// check if we need to read back the pixels (1, 2, 3) from DRAM
bTemp1 = (BYTE)((pParm->rect.wLeft + wCnt - m) % (1L << (4-bMode)));
if (bTemp1)
{
// read back the DWORD where the end point is in
W99AV_ReadDRAMData( _dwGDIHeaders[0] + (wCnt >> (4 - bMode)), &_dwGDIHeaders[1] );
#if IO == IO_PCI
Swap((BYTE*)&_dwGDIHeaders[1]);
#endif
// also put the other pixels in the buffer
for (m=0; m<(1L << (4-bMode))-bTemp1; m++)
{
switch (bMode)
{
case 0:
break;
case 1:
//_Get4Bits( ((BYTE *)&_dwGDIHeaders[1]) + (bTemp1 + m)/2, wCnt%2, &j);
//_Put4Bits(pbBuffer, wCnt%2, j);
//if (wCnt%2)
// pbBuffer++;
break;
case 2:
*pbBuffer++ = *((BYTE*) (&_dwGDIHeaders[1]) + bTemp1 + m);
break;
}
wCnt++;
}
}
//if ((__wGDIy + i) % 2) // check whether the line is in top or bottom field
// _dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwBAddr+4+_dwGDITemp + ((DWORD)i*__RegionList[__bCurrentRegionId].wWidth>>2);
//else
// _dwGDIHeaders[0] = __RegionList[__bCurrentRegionId].dwTAddr+4+_dwGDITemp + ((DWORD)i*__RegionList[__bCurrentRegionId].wWidth>>2);
// output one line to DRAM with burst write, each time 14 DWORD
pbBuffer = __bPixelBuffer;
//printf("end:%d\n", wCnt);
wCnt = wCnt >> (4 - bMode);
#if IO == IO_PCI
for (m=0; m<wCnt; m++)
Swap(pbBuffer+m*4);
#endif
//pbBuffer[3] = 5;
//pbBuffer[2] = 5;
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, wCnt);
/*
for (m=0; m<wCnt/14; m++)
{
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, 14);
pbBuffer = pbBuffer + 56; // 56 => 14 * 4
_dwGDIHeaders[0] = _dwGDIHeaders[0] + 14;
}
if (wCnt % 14)
W99AV_WriteDRAMBurst(_dwGDIHeaders[0], (DWORD*)pbBuffer, wCnt % 14);
*/
}
#endif //#ifndef GDI_EMULATION
#endif //#ifndef NO_GDI
}
// *********************************************************************
// 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 alignme
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -