/** * @brief Callback function for movie player. Uses multiple buffering if * available to avoid tearing effects. * @param hMem: pointer to parent handle * @param Notification: notification ID * @param CurrentFrame: current playing frame * @retval None */ void _cbNotify(GUI_HMEM hMem, int Notification, U32 CurrentFrame) { long progress; WM_HWIN hItem; switch (Notification) { case GUI_MOVIE_NOTIFICATION_PREDRAW: GUI_MULTIBUF_Begin(); break; case GUI_MOVIE_NOTIFICATION_POSTDRAW: GUI_MULTIBUF_End(); progress = 100 * GUI_MOVIE_GetFrameIndex(hMovie)/ Video_Info.NumFrames; hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER); SLIDER_SetValue(hItem, progress); break; case GUI_MOVIE_NOTIFICATION_STOP: if(GUI_MOVIE_GetFrameIndex(hMovie) >= (Video_Info.NumFrames - 1)) { if( FullScreen == 1) { WM_InvalidateWindow(hBigFrame); WM_Update(hBigFrame); } _StopPlay(); if(PlayerSettings.b.repeat != REPEAT_NONE) { if (PlayerSettings.b.repeat == REPEAT_ALL) { if(Video_file_pos < (pVideoList->ptr - 1)) { Video_file_pos++; } else { Video_file_pos = 0; } LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), Video_file_pos); } _StartPlay((char *)pVideoList->file[Video_file_pos].name); } else { hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); } } break; } }
/********************************************************************* * * _SliceInfo * * Purpose: * Called before the first and after the last animation item of one * 'slice' is drawn. A 'slice' means one or more animation item * which need to be drawn at a determined point in time. * * That mechanism is used here to avoid flickering. */ static void _SliceInfo(int State, void * pVoid) { GUI_USE_PARA(pVoid); switch (State) { case GUI_ANIM_START: GUI_MULTIBUF_Begin(); break; case GUI_ANIM_END: GUI_MULTIBUF_End(); break; } }
/********************************************************************* * * _cbNotify * * Purpose: * Callback function for movie player. Uses multiple buffering if * available to avoid tearing effects. */ void _cbNotify(GUI_HMEM hMem, int Notification, U32 CurrentFrame) { switch (Notification) { case GUI_MOVIE_NOTIFICATION_PREDRAW: GUI_MULTIBUF_Begin(); break; case GUI_MOVIE_NOTIFICATION_POSTDRAW: GUI_MULTIBUF_End(); break; case GUI_MOVIE_NOTIFICATION_STOP: break; } }
/* Bounces a small text around the screen */ void drawingLoop(void) { int x = 43; int y = 27; int dx = 1; int dy = 2; while (1) { /* Draw something */ GUI_MULTIBUF_Begin(); GUI_DrawGradientV(0, 0, LCD_WIDTH, LCD_HEIGHT, GUI_BLUE, GUI_GREEN); GUI_DrawBitmap(&bmlogo, x, y); GUI_MULTIBUF_End(); /* Drawing finished. Buffers will be flipped */ GUI_Delay(30); /* Move the image around the screen. Bounce when it hits edges */ if ( x + dx + bmlogo.XSize > LCD_WIDTH ) { dx = -dx; } if ( y + dy + bmlogo.YSize > LCD_HEIGHT ) { dy = -dy; } if ( x + dx < 0 ) { dx = -dx; } if ( y + dy < 0 ) { dy = -dy; } x += dx; y += dy; } }
/** * @brief Callback function for movie player. Uses multiple buffering if * available to avoid tearing effects. * @param hMem: pointer to parent handle * @param Notification: notification ID * @param CurrentFrame: current playing frame * @retval None */ void _cbNotify(GUI_HMEM hMem, int Notification, U32 CurrentFrame) { char tmp[20]; WM_HWIN hItem; switch (Notification) { case GUI_MOVIE_NOTIFICATION_PREDRAW: GUI_SelectLayer(0); GUI_MULTIBUF_Begin(); FrameIndex = GUI_MOVIE_GetFrameIndex(hvideo); if(FrameIndex < PrevFrameIndex) { PrevFrameIndex = FrameIndex; previous_total = 0; } LostFrames += (FrameIndex - PrevFrameIndex); if((FrameIndex - previous_total) >= VIDEO_FRAME_TIME) { hItem = WM_GetDialogItem(playbackwin, ID_FPS); if((VIDEO_FRAME_TIME - LostFrames + 1) < VIDEO_FRAME_TIME) { sprintf(tmp, "Rate : %d fps", VIDEO_FRAME_TIME - LostFrames + 4 < 15 ? 15 : VIDEO_FRAME_TIME - LostFrames + 4); TEXT_SetText(hItem, tmp); } LostFrames = 0; previous_total = FrameIndex; } PrevFrameIndex = FrameIndex + 1; break; case GUI_MOVIE_NOTIFICATION_POSTDRAW: GUI_MULTIBUF_End(); GUI_SelectLayer(1); break; case GUI_MOVIE_NOTIFICATION_STOP: { if(GUI_MOVIE_GetFrameIndex(hvideo) >= (Video_Info.NumFrames - 1)) { _StopPlay(&hvideo, &Video_File); if(file_pos < (VideoList.ptr - 1)) { file_pos++; } else { file_pos = 0; } _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0); } } break; } }
void Test_Font_Drawing_Performance() { GUI_TIMER_TIME StartTime, EndTime; int Sec, ms; char cString[65]; GUI_UC_SetEncodeUTF8(); //繁體中文 速度測試 GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_SetFont(&GUI_FontAR_Mingti_Medium_B523); StartTime = GUI_GetTime(); DisplayArticle((const char*)_acTraditionalCHN_Article); EndTime = GUI_GetTime(); Sec = (EndTime - StartTime) / 1000; ms = (EndTime - StartTime) % 1000; GUI_MULTIBUF_End(); GUI_Delay(1500); GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_DispStringAt("繁體中文字數",280,200); snprintf(cString, sizeof(cString)-1,"%d", sizeof(_acTraditionalCHN_Article)/2); GUI_DispStringAt(cString,500,200); GUI_DispStringAt("總花費時間",280,280); snprintf(cString, sizeof(cString)-1,"%d.%d",Sec,ms); GUI_DispStringAt(cString,460,280); GUI_DispStringAt("秒",600,280); GUI_MULTIBUF_End(); GUI_Delay(3000); //簡體中文 速度測試 GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_SetFont(&GUI_FontHG_GB_Gothic23); StartTime = GUI_GetTime(); DisplayArticle((const char*)_acSimplifiedCHN_Article); EndTime = GUI_GetTime(); Sec = (EndTime - StartTime) / 1000; ms = (EndTime - StartTime) % 1000; GUI_MULTIBUF_End(); GUI_Delay(1500); GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_DispStringAt("简体中文字数",280,200); snprintf(cString, sizeof(cString)-1,"%d", sizeof(_acSimplifiedCHN_Article)/2); GUI_DispStringAt(cString,500,200); GUI_DispStringAt("总花费时间",280,280); snprintf(cString, sizeof(cString)-1,"%d.%d",Sec,ms); GUI_DispStringAt(cString,460,280); GUI_DispStringAt("秒",600,280); GUI_MULTIBUF_End(); GUI_Delay(3000); //日文 速度測試 GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_SetFont(&GUI_FontHGGothicB19); StartTime = GUI_GetTime(); DisplayArticle((const char*)_acJapanese_Article); EndTime = GUI_GetTime(); Sec = (EndTime - StartTime) / 1000; ms = (EndTime - StartTime) % 1000; GUI_MULTIBUF_End(); GUI_Delay(1500); GUI_MULTIBUF_Begin(); GUI_Clear(); GUI_DispStringAt("日文字數",280,200); snprintf(cString, sizeof(cString)-1,"%d", sizeof(_acJapanese_Article)/2); GUI_DispStringAt(cString,440,200); GUI_DispStringAt("總花費時間:",280,280); snprintf(cString, sizeof(cString)-1,"%d.%d",Sec,ms); GUI_DispStringAt(cString,460,280); GUI_DispStringAt("秒",600,280); GUI_MULTIBUF_End(); GUI_Delay(3000); }