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),
57 EnvironmentOptions::~EnvironmentOptions()
61 void EnvironmentOptions::SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
62 unsigned int logFrameRateFrequency,
63 unsigned int logupdateStatusFrequency,
64 unsigned int logPerformanceStats,
65 unsigned int logPerformanceStatsFrequency,
66 unsigned int performanceTimeStampOutput,
67 unsigned int logPanGestureLevel )
69 mLogFunction = logFunction;
70 mFpsFrequency = logFrameRateFrequency;
71 mUpdateStatusFrequency = logupdateStatusFrequency;
72 mPerformanceStatsLevel = logPerformanceStats;
73 mPerformanceStatsFrequency = logPerformanceStatsFrequency;
74 mPerformanceTimeStampOutput= performanceTimeStampOutput;
75 mPanGestureLoggingLevel = logPanGestureLevel;
78 void EnvironmentOptions::InstallLogFunction() const
80 Dali::Integration::Log::InstallLogFunction( mLogFunction );
83 void EnvironmentOptions::UnInstallLogFunction() const
85 Dali::Integration::Log::UninstallLogFunction();
88 unsigned int EnvironmentOptions::GetFrameRateLoggingFrequency() const
93 unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
95 return mUpdateStatusFrequency;
98 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
100 return mPerformanceStatsLevel;
102 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingFrequency() const
104 return mPerformanceStatsFrequency;
106 unsigned int EnvironmentOptions::GetPerformanceTimeStampOutput() const
108 return mPerformanceTimeStampOutput;
111 unsigned int EnvironmentOptions::GetPanGestureLoggingLevel() const
113 return mPanGestureLoggingLevel;
116 int EnvironmentOptions::GetPanGesturePredictionMode() const
118 return mPanGesturePredictionMode;
121 int EnvironmentOptions::GetPanGesturePredictionAmount() const
123 return mPanGesturePredictionAmount;
126 int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
128 return mPanGestureMaxPredictionAmount;
131 int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
133 return mPanGestureMinPredictionAmount;
136 int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
138 return mPanGesturePredictionAmountAdjustment;
141 int EnvironmentOptions::GetPanGestureSmoothingMode() const
143 return mPanGestureSmoothingMode;
146 float EnvironmentOptions::GetPanGestureSmoothingAmount() const
148 return mPanGestureSmoothingAmount;
151 int EnvironmentOptions::GetMinimumPanDistance() const
153 return mPanMinimumDistance;
156 int EnvironmentOptions::GetMinimumPanEvents() const
158 return mPanMinimumEvents;
161 unsigned int EnvironmentOptions::GetWindowWidth() const
166 unsigned int EnvironmentOptions::GetWindowHeight() const
168 return mWindowHeight;
171 void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
173 mPanGesturePredictionMode = mode;
176 void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
178 mPanGesturePredictionAmount = amount;
181 void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
183 mPanGestureMaxPredictionAmount = amount;
186 void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
188 mPanGestureMinPredictionAmount = amount;
191 void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
193 mPanGesturePredictionAmountAdjustment = amount;
196 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
198 mPanGestureSmoothingMode = mode;
201 void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
203 mPanGestureSmoothingAmount = amount;
206 void EnvironmentOptions::SetMinimumPanDistance( int distance )
208 mPanMinimumDistance = distance;
211 void EnvironmentOptions::SetMinimumPanEvents( int events )
213 mPanMinimumEvents = events;
216 void EnvironmentOptions::SetGlesCallTime( int time )
218 mGlesCallTime = time;
221 int EnvironmentOptions::GetGlesCallTime() const
223 return mGlesCallTime;
226 void EnvironmentOptions::SetWindowWidth( int width )
228 mWindowWidth = width;
231 void EnvironmentOptions::SetWindowHeight( int height )
233 mWindowHeight = height;
236 bool EnvironmentOptions::PerformanceServerRequired() const
238 return ( (GetPerformanceStatsLoggingOptions() > 0) ||
239 ( GetPerformanceTimeStampOutput() > 0 ) );