//--------------------------------------------------------------------------- tjs_error TJS_INTF_METHOD tTVPCrossFadeTransHandler::Process( /*in,out*/tTVPDivisibleData *data) { // process divided region of the entire layer bitmap #ifdef TVP_TRANS_SHOW_FPS BlendTick = TVPGetRoughTickCount32(); #endif if(Phase == 0) { // completely source 1 data->Dest = data->Src1; data->DestLeft = data->Src1Left; data->DestTop = data->Src1Top; } else if(Phase == PhaseMax) { // completety source 2 data->Dest = data->Src2; data->DestLeft = data->Src2Left; data->DestTop = data->Src2Top; } else { // blend Blend(data); } #ifdef TVP_TRANS_SHOW_FPS BlendTime += TVPGetRoughTickCount32() - BlendTick; #endif return TJS_S_OK; }
//--------------------------------------------------------------------------- tjs_error TJS_INTF_METHOD tTVPCrossFadeTransHandler::EndProcess() { // notifies ending of the update #ifdef TVP_TRANS_SHOW_FPS ProcessTime += TVPGetRoughTickCount32() - ProcessTick; #endif if(Phase >= PhaseMax) return TJS_S_FALSE; return TJS_S_TRUE; }
//--------------------------------------------------------------------------- tjs_error TJS_INTF_METHOD tTVPCrossFadeTransHandler:: StartProcess(tjs_uint64 tick) { // notifies starting of the update if(First) { First = false; StartTick = tick; } // compute phase ( 0 thru 255 ) Phase = (tick - StartTick) * PhaseMax / Time; if(Phase >= PhaseMax) Phase = PhaseMax; #ifdef TVP_TRANS_SHOW_FPS if((tick-StartTick) >= Time/2) { if(Count) { TVPAddLog(TJS_W("update count : ") + ttstr(Count)); TVPAddLog(TJS_W("trans time : ") + ttstr((tjs_int)(tick-StartTick))); TVPAddLog(TJS_W("process time : ") + ttstr((tjs_int)ProcessTime)); TVPAddLog(TJS_W("process time / trans time (%) : ") + ttstr((tjs_int)(ProcessTime*100/(tick-StartTick)))); TVPAddLog(TJS_W("blend time / trans time (%) : ") + ttstr((tjs_int)(BlendTime*100/(tick-StartTick)))); // TVPAddLog(TJS_W("blt time / trans time (%) : ") + // ttstr((tjs_int)(acctime*100/(tick-StartTick)))); tjs_int avgtime; avgtime = ProcessTime / Count; TVPAddLog(TJS_W("process time / update count : ") + ttstr(avgtime)); tjs_int fps = Count * 1000 / (tick - StartTick); TVPAddLog(TJS_W("fps : ") + ttstr(fps)); Count = 0; } } else { Count++; } ProcessTick = TVPGetRoughTickCount32(); #endif return TJS_S_TRUE; }
//--------------------------------------------------------------------------- static DWORD TVPCheckTickOverflow() { DWORD curtick; { // thread-protected tTJSCriticalSectionHolder holder(TVPTickWatchCS); curtick = TVPGetRoughTickCount32(); if(curtick < TVPWatchLastTick) { // timeGetTime() was overflowed TVPTickCountBias += 0x100000000L; // add 1<<32 } TVPWatchLastTick = curtick; } // end-of-thread-protected return curtick; }
//--------------------------------------------------------------------------- tTVPWatchThread::tTVPWatchThread() : tTVPThread(true) { TVPWatchLastTick = TVPGetRoughTickCount32(); SetPriority(ttpNormal); Resume(); }