-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
#include "test-application.h"
TestApplication::TestApplication( size_t surfaceWidth,
size_t surfaceHeight,
float horizontalDpi,
- float verticalDpi)
+ float verticalDpi,
+ ResourcePolicy::DataRetention policy)
: mCore( NULL ),
mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
- mDpi( horizontalDpi, verticalDpi )
+ mDpi( horizontalDpi, verticalDpi ),
+ mLastVSyncTime(0u),
+ mDataRetentionPolicy( policy )
{
Initialize();
}
size_t surfaceWidth,
size_t surfaceHeight,
float horizontalDpi,
- float verticalDpi )
+ float verticalDpi,
+ ResourcePolicy::DataRetention policy)
: mCore( NULL ),
mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
- mDpi( horizontalDpi, verticalDpi )
+ mDpi( horizontalDpi, verticalDpi ),
+ mDataRetentionPolicy( policy )
{
if ( initialize )
{
mPlatformAbstraction,
mGlAbstraction,
mGlSyncAbstraction,
- mGestureManager );
+ mGestureManager,
+ mDataRetentionPolicy);
mCore->ContextCreated();
mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
Dali::Integration::Log::InstallLogFunction(logFunction);
+
+ mCore->SceneCreated();
}
TestApplication::~TestApplication()
mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
}
-bool TestApplication::Render( unsigned int intervalMilliseconds )
+void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
{
+ uint64_t seconds(0u), nanoseconds(0u);
+ mPlatformAbstraction.GetTimeNanoseconds( seconds, nanoseconds );
+ mLastVSyncTime = ( seconds * 1e3 ) + ( nanoseconds / 1e6 );
+ unsigned int nextVSyncTime = mLastVSyncTime + 16;
+
// Update Time values
mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
- unsigned int seconds(0u), microseconds(0u);
- mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
- mCore->VSync( mFrame, seconds, microseconds );
- mCore->Update( mStatus );
+ float elapsedSeconds = intervalMilliseconds / 1e3f;
+ mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+}
+
+bool TestApplication::Render( unsigned int intervalMilliseconds )
+{
+ DoUpdate( intervalMilliseconds );
mCore->Render( mRenderStatus );
mFrame++;
bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds )
{
- // Update Time values
- mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
- unsigned int seconds(0u), microseconds(0u);
- mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
-
- mCore->VSync( mFrame, seconds, microseconds );
- mCore->Update( mStatus );
-
+ DoUpdate( intervalMilliseconds );
return mStatus.KeepUpdating();
}
void TestApplication::ResetContext()
{
- mCore->ContextToBeDestroyed();
+ mCore->ContextDestroyed();
mCore->ContextCreated();
}