Merge "(Build) Specify vconf package so there is no ambiguity" into tizen
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include "environment-options.h"
20
21 namespace Dali
22 {
23
24 namespace Internal
25 {
26
27 namespace Adaptor
28 {
29
30 namespace
31 {
32 const unsigned int DEFAULT_STATISTICS_LOG_FREQUENCY = 2;
33 }
34 EnvironmentOptions::EnvironmentOptions()
35 : mFpsFrequency(0),
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),
50   mGlesCallTime(0),
51   mLogFunction( NULL )
52 {
53 }
54
55 EnvironmentOptions::~EnvironmentOptions()
56 {
57 }
58
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 )
66 {
67   mLogFunction = logFunction;
68   mFpsFrequency = logFrameRateFrequency;
69   mUpdateStatusFrequency = logupdateStatusFrequency;
70   mPerformanceStatsLevel = logPerformanceStats;
71   mPerformanceStatsFrequency = logPerformanceStatsFrequency;
72   mPerformanceTimeStampOutput= performanceTimeStampOutput;
73   mPanGestureLoggingLevel = logPanGestureLevel;
74 }
75
76 void EnvironmentOptions::InstallLogFunction() const
77 {
78   Dali::Integration::Log::InstallLogFunction( mLogFunction );
79 }
80
81 void EnvironmentOptions::UnInstallLogFunction() const
82 {
83   Dali::Integration::Log::UninstallLogFunction();
84 }
85
86 unsigned int EnvironmentOptions::GetFrameRateLoggingFrequency() const
87 {
88   return mFpsFrequency;
89 }
90
91 unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
92 {
93   return mUpdateStatusFrequency;
94 }
95
96 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
97 {
98   return mPerformanceStatsLevel;
99 }
100 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingFrequency() const
101 {
102   return mPerformanceStatsFrequency;
103 }
104 unsigned int EnvironmentOptions::GetPerformanceTimeStampOutput() const
105 {
106   return mPerformanceTimeStampOutput;
107 }
108
109 unsigned int EnvironmentOptions::GetPanGestureLoggingLevel() const
110 {
111   return mPanGestureLoggingLevel;
112 }
113
114 int EnvironmentOptions::GetPanGesturePredictionMode() const
115 {
116   return mPanGesturePredictionMode;
117 }
118
119 int EnvironmentOptions::GetPanGesturePredictionAmount() const
120 {
121   return mPanGesturePredictionAmount;
122 }
123
124 int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
125 {
126   return mPanGestureMaxPredictionAmount;
127 }
128
129 int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
130 {
131   return mPanGestureMinPredictionAmount;
132 }
133
134 int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
135 {
136   return mPanGesturePredictionAmountAdjustment;
137 }
138
139 int EnvironmentOptions::GetPanGestureSmoothingMode() const
140 {
141   return mPanGestureSmoothingMode;
142 }
143
144 float EnvironmentOptions::GetPanGestureSmoothingAmount() const
145 {
146   return mPanGestureSmoothingAmount;
147 }
148
149 int EnvironmentOptions::GetMinimumPanDistance() const
150 {
151   return mPanMinimumDistance;
152 }
153
154 int EnvironmentOptions::GetMinimumPanEvents() const
155 {
156   return mPanMinimumEvents;
157 }
158
159 void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
160 {
161   mPanGesturePredictionMode = mode;
162 }
163
164 void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
165 {
166   mPanGesturePredictionAmount = amount;
167 }
168
169 void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
170 {
171   mPanGestureMaxPredictionAmount = amount;
172 }
173
174 void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
175 {
176   mPanGestureMinPredictionAmount = amount;
177 }
178
179 void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
180 {
181   mPanGesturePredictionAmountAdjustment = amount;
182 }
183
184 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
185 {
186   mPanGestureSmoothingMode = mode;
187 }
188
189 void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
190 {
191   mPanGestureSmoothingAmount = amount;
192 }
193
194 void EnvironmentOptions::SetMinimumPanDistance( int distance )
195 {
196   mPanMinimumDistance = distance;
197 }
198
199 void EnvironmentOptions::SetMinimumPanEvents( int events )
200 {
201   mPanMinimumEvents = events;
202 }
203
204 void EnvironmentOptions::SetGlesCallTime( int time )
205 {
206   mGlesCallTime = time;
207 }
208
209 int EnvironmentOptions::GetGlesCallTime() const
210 {
211   return mGlesCallTime;
212 }
213
214 bool EnvironmentOptions::PerformanceServerRequired() const
215 {
216   return ( (GetPerformanceStatsLoggingOptions() > 0) ||
217            ( GetPerformanceTimeStampOutput() > 0 ) );
218 }
219
220 } // Adaptor
221
222 } // Internal
223
224 } // Dali