|
在绘制GIF时肉眼可见的卡顿,而且刷新时还能看到从上到下的刷新,请问有没有优化的办法?
//===============================================================
void PowerOnDrawGif(void)
{
if (DrawGifCount < GifInfo.NumImages)
{
GUI_GIF_GetImageInfo(_acLogo2, sizeof(_acLogo2), &ImageInfo, DrawGifCount);
GUI_GIF_DrawSub(_acLogo2,
sizeof(_acLogo2),
(LCD_X_SIZE - GifInfo.xSize) / 2,
(LCD_Y_SIZE - GifInfo.ySize) / 2,
DrawGifCount);
}
else
{
DrawGifCount = 0;
}
}
//===============================================================
void _cbPowerOnLogo(WM_MESSAGE * pMsg)
{
PowerOnLogoData_t PowerOnLogoData;
GUI_GIF_GetInfo(_acLogo2, sizeof(_acLogo2), &GifInfo);
switch(pMsg->MsgId)
{
case WM_SET_FOCUS:
{
pMsg->Data.v = 0;
}
break;
case WM_CREATE:
{
// 初始化第一帧信息
GUI_GIF_GetImageInfo(_acLogo2, sizeof(_acLogo2), &ImageInfo, 0);
PowerOnLogoData.Tick = 0;
//PowerOnLogoData.CurPos = 0;
//PowerOnLogoData.LastPos = 0;
PowerOnLogoData.hTimer = WM_CreateTimer(pMsg->hWin,TIMER_ID_LOGO_ROUND,ImageInfo.Delay * 10 / portTICK_PERIOD_MS,0);
WM_SetUserData(pMsg->hWin,&PowerOnLogoData,sizeof(PowerOnLogoData));
DrawGifCount = 0; // 重置帧计数器
}
break;
case WM_DELETE:
{
UpdataDeviceNameToBt();
do
{
__disable_irq();
if(NULL != g_ch1SelfTest)
{
g_ch1SelfTest->ExitTest();
}
__enable_irq();
GUI_X_Delay(LOGO_TIMER_MS / portTICK_PERIOD_MS);
}while(NULL != g_ch1SelfTest);
}
break;
case WM_TIMER:
{
SelftestError_t Error;
uint32_t PercentCur = 0;
uint32_t TimerId;
TimerId = WM_GetTimerId(pMsg->Data.v);
WM_GetUserData(pMsg->hWin,&PowerOnLogoData,sizeof(PowerOnLogoData));
if(TIMER_ID_LOGO_ROUND == TimerId)
{
WM_HWIN hWin;
hWin = WM_SelectWindow(pMsg->hWin);
WM_RestartTimer(pMsg->Data.v,ImageInfo.Delay * 15 / portTICK_PERIOD_MS);
PowerOnDrawGif();
DrawGifCount = (DrawGifCount + 1) % GifInfo.NumImages;
GUI_GIF_GetImageInfo(_acLogo2, sizeof(_acLogo2), &ImageInfo, DrawGifCount);
WM_SelectWindow(hWin);
WM_SetUserData(pMsg->hWin,&PowerOnLogoData,sizeof(PowerOnLogoData));
break;
}
WM_SelectWindow(pMsg->hWin);
WM_RestartTimer(pMsg->Data.v,LOGO_TIMER_MS / portTICK_PERIOD_MS);
if(PowerOnLogoData.Tick < LOGO_EXIT_MS / LOGO_TIMER_MS)
{
PowerOnLogoData.Tick++;
}
Error.Error = 0;
if(NULL != g_ch1SelfTest)
{
Error = g_ch1SelfTest->GetError();
}
if(0 != Error.Error)
{
GUI_RECT Rect;
GUI_SetFont(&GUI_DEFAULT_FONT);
WM_GetClientRect(&Rect);
GUI_SetColor(PWON_ERROR_COLOR1);
GUI_SetBkColor(PWON_ERROR_BKCOLOR1);
Rect.y1 = PWON_ERROR_INFO1_YSIZE - 1;
GUI_DispStringInRectFill_Buf(DEV_NAME_STRING,&Rect,GUI_TA_HCENTER | GUI_TA_VCENTER);
GUI_SetColor(PWON_ERROR_COLOR2);
GUI_SetBkColor(PWON_ERROR_BKCOLOR2);
GetTestErrorMessage(Error,(char *)g_DispBuf,sizeof(g_DispBuf));
Rect.y0 = PWON_ERROR_INFO1_YSIZE;
Rect.y1 = Rect.y0 + PWON_ERROR_INFO2_YSIZE - 1;
GUI_DrawFillRectEx(&Rect,PWON_ERROR_BKCOLOR2);
GUI_DispStringInRect((char *)g_DispBuf,&Rect,GUI_TA_HCENTER | GUI_TA_VCENTER);
GUI_SetColor(PWON_ERROR_COLOR3);
GUI_SetBkColor(PWON_ERROR_BKCOLOR3);
WM_GetClientRect(&Rect);
Rect.y0 = PWON_ERROR_INFO1_YSIZE + PWON_ERROR_INFO2_YSIZE;
GUI_DispStringInRectFill_Buf(NET_ADR,&Rect,GUI_TA_RIGHT | GUI_TA_VCENTER);
WM_DeleteTimer(pMsg->Data.v);
WM_DeleteTimer(PowerOnLogoData.hTimer);
SetSoundOutput(tSoundErr);
break;
}
PercentCur = 0;
if(NULL != g_ch1SelfTest)
{
PercentCur = g_ch1SelfTest->GetProgress();
}
if(PercentCur > PowerOnLogoData.Tick * (100 * LOGO_TIMER_MS / SELE_TEST_MIN_MS))
{
PercentCur = PowerOnLogoData.Tick * (100 * LOGO_TIMER_MS / SELE_TEST_MIN_MS);
}
if(PowerOnLogoData.Percent != PercentCur)
{
PowerOnLogoData.Percent = PercentCur;
}
PowerOnLogoData.Percent = PercentCur;
WM_SetUserData(pMsg->hWin,&PowerOnLogoData,sizeof(PowerOnLogoData));
if(NULL != g_ch1SelfTest)
{
if(eTest_ChkSucces != g_ch1SelfTest->GetCheckStatus())
{
break;
}
}
if(PowerOnLogoData.Tick < LOGO_EXIT_MS / 200)
{
break;
}
WM_DeleteWindow(pMsg->hWin);
g_bReDrawID = TRUE;
g_CurPageId.Page = PAGE_DESK;
g_CurPageId.Id = ID_DESK_CH1_V;
TurnToFocus();
}
break;
case WM_KEY:
{
#if 0
if(((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)
{
if(KEY_LOK == ((WM_KEY_INFO*)(pMsg->Data.p))->Key)
{
RCC_ClearFlag();
WM_DeleteWindow(pMsg->hWin);
g_bReDrawID = TRUE;
g_CurPageId.Page = PAGE_DESK;
g_CurPageId.Id = ID_DESK_SHOWALL;
TurnToFocus();
}
}
#endif
}
break;
case WM_PAINT:
{
GUI_RECT Rect;
WM_GetClientRect(&Rect);
GUI_DrawFillRectEx(&Rect,GUI_BLACK);
WM_GetUserData(pMsg->hWin,&PowerOnLogoData,sizeof(PowerOnLogoData));
PowerOnDrawGif();
}
break;
default:
{
WM_DefaultProc(pMsg);
}
break;
}
}
|
|