📄 osd.c
字号:
if((c = ((BYTE *) s0)[unFontLoc]) == '\0')
break;
unFontLoc++;
if((pFont = (BYTE *) font_table2[c]) == NULL)
if((pFont = (BYTE *) font_table[c]) == NULL)
continue;
}
else
{
if(c == '\n')
{
c = ' ';
//get pattern table
pPattern = (BYTE *) pattern_4Normal; //pattern_4Prog;//jhang 2002/4/24 change
}
else
{
pPattern = (BYTE *) pattern_4Normal;
}
//get current char entry
if((pFont = (BYTE *) font_table[c]) == NULL)
continue;
}
//get font information
iFontWidth = (int)pFont[0];
iFontHigh = (int)(pFont[1] / 2);
//how many byte need for one word
j = iFontWidth / ONE_BYTE_POINT;
if(iWidth < j) //iWidth is how many byte on this region
break;
else
iWidth -= j;
//get pattern entry
pFont += 3;
//calucation font width for UINT16, 32/4=8 byte/2=4 word
space = j;
//initialize buffer start
pTopLine =
(UINT16 *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[0] * 32 +
OSD_DATA_OFFSET(p->osd_format));
pBotLine =
(UINT16 *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[1] * 32 +
OSD_DATA_OFFSET(p->osd_format));
//start to draw
nibble_changed = 0;
for(j = 0; j < iFontHigh; j++)
{
///////////////top//////////////////
for(i = 0; i < space; i++)
{
if(i % 2 == 0)
{
pTopLine[i + unDispLoc] = pPattern[(pFont[i / 2] >> 4)];
}
else
{
pTopLine[i + unDispLoc] = pPattern[(pFont[i / 2] & 0x0f)];
}
}
pTopLine += W;
pFont += (iFontWidth / 8);
if(space % 2 == 1)
{
nibble_changed = ((++nibble_changed) % 2); //1;
}
else
{
nibble_changed = 0;
}
///////////////bot//////////////
for(i = 0; i < space; i++)
{
if(nibble_changed == 1)
{
if(i % 2 == 0)
{
pBotLine[i + unDispLoc] = pPattern[(pFont[(i + 1) / 2] & 0x0f)];
}
else
{
pBotLine[i + unDispLoc] = pPattern[(pFont[(i + 1) / 2] >> 4)];
}
}
else
{
if(i % 2 == 0)
{
pBotLine[i + unDispLoc] = pPattern[(pFont[i / 2] >> 4)];
}
else
{
pBotLine[i + unDispLoc] = pPattern[(pFont[i / 2] & 0x0f)];
}
}
}
pBotLine += W;
if(nibble_changed == 0)
pFont += (iFontWidth / 8);
else
pFont += ((iFontWidth + 8) / 8);
nibble_changed = 0;
} //for charactor high
//change to next OSD buffer point
unDispLoc += space; //(iFontWidth / 8);
} //while
//clear last data to space
//the region high
//////////for interlaced////////////
iFontHigh = p->osd_h / 2;
///////////////////////////////////////
//the last space need to fill
iWidth = iWidth;
if(iWidth)
{
//initialize buffer start
pTopLine =
(UINT16 *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[0] * 32 +
OSD_DATA_OFFSET(p->osd_format));
pBotLine =
(UINT16 *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[1] * 32 +
OSD_DATA_OFFSET(p->osd_format));
for(j = 0; j < iFontHigh; j++)
{
for(i = 0; i < iWidth; i++)
{
pTopLine[i + unDispLoc] = 0xaa; //aa;
pBotLine[i + unDispLoc] = 0xaa; //aa;
}
pTopLine += W;
/////////for inetrlaced////////
pBotLine += W;
/////////////////////////////
}
}
}
#endif
#ifdef SUPPORT_BIG_SCORE_DISPLAY
void osd_print_score(t_osd_region * p, const char *s0)
{
/*
Function : draw a string on OSD region
Action : now the font width has two size, on is 16 point for english
and one is 32 point for chinese
Notice : 1. The font width must is time of 8
2. if the font high is more then region area, program will be fail
3. the font high must be even
*/
int iWidth = p->osd_w;
int W = iWidth;
BYTE *pTopLine;
BYTE *pBotLine;
BYTE *pFont = 0; //Tony modified 02/05/06 prevent from warning,
//pFont might be used uninitialized in this function,
// at compiling time
BYTE *pPattern;
UINT16 space;
UINT16 unFontLoc;
UINT16 unDispLoc;
UINT16 TempLoc;
UINT16 unFontMemLoc;
int i, j, nibble_changed;
int iFontHigh, iFontWidth;
BYTE c;
pPattern = (BYTE *) pattern_4Normal;
unDispLoc = unFontLoc = 0;
//process each charactor
while((c = ((BYTE *) s0)[unFontLoc]) != '\0')
{
#ifdef DEBUG_IR_CODE
if(c >= 'a' && c <= 'z')
c -= 0x20;
#endif
unFontLoc++;
if(c == '\r')
{
//prefix characher:to use font_table2 Jeff 20010906
if((c = ((BYTE *) s0)[unFontLoc]) == '\0')
break;
unFontLoc++;
if((pFont = (BYTE *) font_table2[c]) == NULL)
if((pFont = (BYTE *) font_table[c]) == NULL)
continue;
}
else
{
if(c == '\n')
{
c = ' ';
pPattern = (BYTE *) pattern_4Normal;
}
else
{
pPattern = (BYTE *) pattern_4Normal;
}
//osd_font_page=1;
//c=0x15;
//get current char entry
if(osd_font_page == 0) //jasing add
{
if((pFont = (BYTE *) font_table[c]) == NULL)
continue;
}
else if(osd_font_page == 1)
{
c = reindex(c);
if((pFont = (BYTE *) font_table2[c]) == NULL)
continue;
}
}
#ifdef ADD_DECMP
if((pFont[0] & 0xf0) == 0xf0) // first byte in compress array is flag of compression, panxing, 2001-11-27
// is not bigger then 0x20, panxing, 2001-11-27
{
decmp(pFont, decode);
pFont = decode;
}
#endif //ADD_DECMP
//get font information
iFontWidth = (int)pFont[0];
////////for interlaced////////
#if 0
//if (bScanMode == OSD_INTERLACED)
//iFontHigh = (int) (pFont[1]/2);
//else
#endif
//////////////////////////////
iFontHigh = (int)(pFont[1]);
//how many byte need for is word
j = iFontWidth / 8;
//j=iFontWidth/pFont[2];
if(iWidth < j) //iWidth is how many byte on this region
break;
else
iWidth -= j;
//if necessary,program will compare OSD region high with font
//if (iFontHigh>p->osd_h)
// iFontHigh=p->osd_h;
//get pattern entry
pFont += 3;
//calucation font width for UINT16, 32/4=8 byte/2=4 word
space = j; ////// 2;
//initialize buffer start
pTopLine =
(BYTE *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[0] * 32 +
OSD_DATA_OFFSET(p->osd_format));
pBotLine =
(BYTE *) (((BYTE *) get_osdbuf_baseptr()) + p->osd_header[1] * 32 +
OSD_DATA_OFFSET(p->osd_format));
//start to draw
nibble_changed = 0;
unFontMemLoc = 0;
for(j = 0; j < iFontHigh; j++)
{
TempLoc=unDispLoc;
//top
for(i = 0; i < space; i++)
{
int c,d,e;
for(d=0;d<8;d++)
{
if(pFont[unFontMemLoc]&(0x80>>d))
{
for(c=0;c<4;c++)
for(e=0;e<4;e++)
{
pTopLine[e+d+TempLoc+c*W] = 0xff;
}
}else
{
for(c=0;c<4;c++)
for(e=0;e<4;e++)
{
pTopLine[e+d+TempLoc+c*W] = 0;
}
}
}
TempLoc+=8;
unFontMemLoc++;
}
pTopLine += 4*W;
} //for charactor high
//change to next OSD buffer point
unDispLoc += 24; //(iFontWidth / 8);
}
iFontHigh = p->osd_h;
}
#endif
void osd_print_region(t_osd_region * p, const char *s0)
{
/*
Function : draw a string on OSD region
Action : now the font width has two size, on is 16 point for english
and one is 32 point for chinese
Notice : 1. The font width must is time of 8
2. if the font high is more then region area, program will be fail
3. the font high must be even
*/
int iWidth = p->osd_w;
int W = iWidth;
BYTE *pTopLine;
BYTE *pBotLine;
BYTE *pFont = 0; //Tony modified 02/05/06 prevent from warning,
//pFont might be used uninitialized in this function,
// at compiling time
BYTE *pPattern;
UINT16 space;
UINT16 unFontLoc;
UINT16 unDispLoc;
UINT16 unFontMemLoc;
int i, j, nibble_change
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -