2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "environment-options.h"
32 const unsigned int DEFAULT_STATISTICS_LOG_FREQUENCY = 2;
34 EnvironmentOptions::EnvironmentOptions()
36 mUpdateStatusFrequency(0),
37 mPerformanceStatsLevel(0),
38 mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY),
39 mPerformanceTimeStampOutput(0),
40 mPanGestureLoggingLevel(0),
41 mPanGesturePredictionMode(-1),
42 mPanGesturePredictionAmount(-1), ///< only sets value in pan gesture if greater than 0
43 mPanGestureMaxPredictionAmount(-1),
44 mPanGestureMinPredictionAmount(-1),
45 mPanGesturePredictionAmountAdjustment(-1),
46 mPanGestureSmoothingMode(-1),
47 mPanGestureSmoothingAmount(-1.0f),
48 mPanMinimumDistance(-1),
49 mPanMinimumEvents(-1),
55 EnvironmentOptions::~EnvironmentOptions()
59 void EnvironmentOptions::SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
60 unsigned int logFrameRateFrequency,
61 unsigned int logupdateStatusFrequency,
62 unsigned int logPerformanceStats,
63 unsigned int logPerformanceStatsFrequency,
64 unsigned int performanceTimeStampOutput,
65 unsigned int logPanGestureLevel )
67 mLogFunction = logFunction;
68 mFpsFrequency = logFrameRateFrequency;
69 mUpdateStatusFrequency = logupdateStatusFrequency;
70 mPerformanceStatsLevel = logPerformanceStats;
71 mPerformanceStatsFrequency = logPerformanceStatsFrequency;
72 mPerformanceTimeStampOutput= performanceTimeStampOutput;
73 mPanGestureLoggingLevel = logPanGestureLevel;
76 void EnvironmentOptions::InstallLogFunction() const
78 Dali::Integration::Log::InstallLogFunction( mLogFunction );
81 void EnvironmentOptions::UnInstallLogFunction() const
83 Dali::Integration::Log::UninstallLogFunction();
86 unsigned int EnvironmentOptions::GetFrameRateLoggingFrequency() const
91 unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
93 return mUpdateStatusFrequency;
96 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
98 return mPerformanceStatsLevel;
100 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingFrequency() const
102 return mPerformanceStatsFrequency;
104 unsigned int EnvironmentOptions::GetPerformanceTimeStampOutput() const
106 return mPerformanceTimeStampOutput;
109 unsigned int EnvironmentOptions::GetPanGestureLoggingLevel() const
111 return mPanGestureLoggingLevel;
114 int EnvironmentOptions::GetPanGesturePredictionMode() const
116 return mPanGesturePredictionMode;
119 int EnvironmentOptions::GetPanGesturePredictionAmount() const
121 return mPanGesturePredictionAmount;
124 int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
126 return mPanGestureMaxPredictionAmount;
129 int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
131 return mPanGestureMinPredictionAmount;
134 int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
136 return mPanGesturePredictionAmountAdjustment;
139 int EnvironmentOptions::GetPanGestureSmoothingMode() const
141 return mPanGestureSmoothingMode;
144 float EnvironmentOptions::GetPanGestureSmoothingAmount() const
146 return mPanGestureSmoothingAmount;
149 int EnvironmentOptions::GetMinimumPanDistance() const
151 return mPanMinimumDistance;
154 int EnvironmentOptions::GetMinimumPanEvents() const
156 return mPanMinimumEvents;
159 void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
161 mPanGesturePredictionMode = mode;
164 void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
166 mPanGesturePredictionAmount = amount;
169 void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
171 mPanGestureMaxPredictionAmount = amount;
174 void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
176 mPanGestureMinPredictionAmount = amount;
179 void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
181 mPanGesturePredictionAmountAdjustment = amount;
184 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
186 mPanGestureSmoothingMode = mode;
189 void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
191 mPanGestureSmoothingAmount = amount;
194 void EnvironmentOptions::SetMinimumPanDistance( int distance )
196 mPanMinimumDistance = distance;
199 void EnvironmentOptions::SetMinimumPanEvents( int events )
201 mPanMinimumEvents = events;
204 void EnvironmentOptions::SetGlesCallTime( int time )
206 mGlesCallTime = time;
209 int EnvironmentOptions::GetGlesCallTime() const
211 return mGlesCallTime;
214 bool EnvironmentOptions::PerformanceServerRequired() const
216 return ( (GetPerformanceStatsLoggingOptions() > 0) ||
217 ( GetPerformanceTimeStampOutput() > 0 ) );