[mw_shl_code=c,true]UCOSIII+UCGUI+战舰+原子4.3电容屏[/mw_shl_code]
[mw_shl_code=c,true]自己参考网上的方法做了画点,画线,填充矩形,16bpp的优化,但我的刷屏速度只有这样:[/mw_shl_code]
[mw_shl_code=c,true]
[/mw_shl_code]
[mw_shl_code=c,true]看到别人的刷屏都是900万像素每秒,甚至3000万,牛人帮我看看程序[/mw_shl_code]
[mw_shl_code=c,true]画线:[/mw_shl_code]
[mw_shl_code=c,true]/*********************************************************************
*
* LCD_L0_DrawHLine
*/
void LCD_L0_DrawHLine (int x0, int y, int x1) {
u16 f;
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
for (; x0 <= x1; x0++) {
LCD_L0_XorPixel(x0, y);
}
} else {
f = x1 - x0 + 1;
LCD_SetCursor(x0, y);//设置光标
LCDX->LCD_REG=lcddev.wramcmd;//写入GRAM
for (; f > 0;f --) {
LCDX->LCD_RAM=LCD_COLORINDEX;
//LCD_L0_SetPixelIndex(x0, y, LCD_COLORINDEX);
}
}
}[/mw_shl_code]
[mw_shl_code=c,true]/*********************************************************************
*
* LCD_L0_DrawVLine
*/
void LCD_L0_DrawVLine (int x, int y0, int y1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
for (; y0 <= y1; y0++) {
LCD_L0_XorPixel(x, y0);
}
} else {
for (; y0 <= y1; y0++) {
LCD_L0_SetPixelIndex(x, y0, LCD_COLORINDEX);
}
}
}
[/mw_shl_code]
填充矩形:
[mw_shl_code=c,true]/*********************************************************************
*
* LCD_L0_FillRect
*/
void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
u16 i , j;
u16 xlen;
xlen = x1 - x0 + 1;
for(i = y0; i <= y1; i++)
{
LCD_SetCursor(x0, i) ;
LCDX->LCD_REG=lcddev.wramcmd;
for(j = 0; j < xlen; j++)
LCDX->LCD_RAM = LCD_COLORINDEX;
}
// for (; y0 <= y1; y0++) {
// LCD_L0_DrawHLine(x0, y0, x1);
// }
}[/mw_shl_code]
16bpp:
(这里优化后刷控件速度快多了)
[mw_shl_code=c,true]/*********************************************************************
*
* Draw Bitmap 16 BPP
*/
#if (LCD_BITSPERPIXEL > 8)
static void DrawBitLine16BPP(int x, int y, U16 const GUI_UNI_PTR * p, int xsize, const LCD_PIXELINDEX * pTrans) {
LCD_PIXELINDEX pixel;
if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
if (pTrans) {
LCD_SetCursor(x, y) ;
LCDX->LCD_REG=lcddev.wramcmd;
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
LCDX->LCD_RAM = *(pTrans + pixel);
// LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
}
} else {
LCD_SetCursor(x, y) ;
LCDX->LCD_REG=lcddev.wramcmd;
for (;xsize > 0; xsize--, x++, p++) {
LCDX->LCD_RAM = *p;
// LCD_L0_SetPixelIndex(x, y, *p);
}
}
} else {
if (pTrans) {
LCD_SetCursor(x, y) ;
LCDX->LCD_REG=lcddev.wramcmd;
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
LCDX->LCD_RAM = *(pTrans + pixel);
// LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
}
}
} else {
LCD_SetCursor(x, y) ;
LCDX->LCD_REG=lcddev.wramcmd;
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
LCDX->LCD_RAM = pixel;
// LCD_L0_SetPixelIndex(x, y, pixel);
}
}
}
}
}[/mw_shl_code]
希望优化到看不见刷屏,现在还是能看见从上到下的刷屏 |