Merge "Actor's Transformation API Cleanup" 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   mWindowWidth( 0 ),
52   mWindowHeight( 0 ),
53   mLogFunction( NULL )
54 {
55 }
56
57 EnvironmentOptions::~EnvironmentOptions()
58 {
59 }
60
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 )
68 {
69   mLogFunction = logFunction;
70   mFpsFrequency = logFrameRateFrequency;
71   mUpdateStatusFrequency = logupdateStatusFrequency;
72   mPerformanceStatsLevel = logPerformanceStats;
73   mPerformanceStatsFrequency = logPerformanceStatsFrequency;
74   mPerformanceTimeStampOutput= performanceTimeStampOutput;
75   mPanGestureLoggingLevel = logPanGestureLevel;
76 }
77
78 void EnvironmentOptions::InstallLogFunction() const
79 {
80   Dali::Integration::Log::InstallLogFunction( mLogFunction );
81 }
82
83 void EnvironmentOptions::UnInstallLogFunction() const
84 {
85   Dali::Integration::Log::UninstallLogFunction();
86 }
87
88 unsigned int EnvironmentOptions::GetFrameRateLoggingFrequency() const
89 {
90   return mFpsFrequency;
91 }
92
93 unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
94 {
95   return mUpdateStatusFrequency;
96 }
97
98 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
99 {
100   return mPerformanceStatsLevel;
101 }
102 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingFrequency() const
103 {
104   return mPerformanceStatsFrequency;
105 }
106 unsigned int EnvironmentOptions::GetPerformanceTimeStampOutput() const
107 {
108   return mPerformanceTimeStampOutput;
109 }
110
111 unsigned int EnvironmentOptions::GetPanGestureLoggingLevel() const
112 {
113   return mPanGestureLoggingLevel;
114 }
115
116 int EnvironmentOptions::GetPanGesturePredictionMode() const
117 {
118   return mPanGesturePredictionMode;
119 }
120
121 int EnvironmentOptions::GetPanGesturePredictionAmount() const
122 {
123   return mPanGesturePredictionAmount;
124 }
125
126 int EnvironmentOptions::GetPanGestureMaximumPredictionAmount() const
127 {
128   return mPanGestureMaxPredictionAmount;
129 }
130
131 int EnvironmentOptions::GetPanGestureMinimumPredictionAmount() const
132 {
133   return mPanGestureMinPredictionAmount;
134 }
135
136 int EnvironmentOptions::GetPanGesturePredictionAmountAdjustment() const
137 {
138   return mPanGesturePredictionAmountAdjustment;
139 }
140
141 int EnvironmentOptions::GetPanGestureSmoothingMode() const
142 {
143   return mPanGestureSmoothingMode;
144 }
145
146 float EnvironmentOptions::GetPanGestureSmoothingAmount() const
147 {
148   return mPanGestureSmoothingAmount;
149 }
150
151 int EnvironmentOptions::GetMinimumPanDistance() const
152 {
153   return mPanMinimumDistance;
154 }
155
156 int EnvironmentOptions::GetMinimumPanEvents() const
157 {
158   return mPanMinimumEvents;
159 }
160
161 unsigned int EnvironmentOptions::GetWindowWidth() const
162 {
163   return mWindowWidth;
164 }
165
166 unsigned int EnvironmentOptions::GetWindowHeight() const
167 {
168   return mWindowHeight;
169 }
170
171 void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode )
172 {
173   mPanGesturePredictionMode = mode;
174 }
175
176 void EnvironmentOptions::SetPanGesturePredictionAmount( unsigned int amount )
177 {
178   mPanGesturePredictionAmount = amount;
179 }
180
181 void EnvironmentOptions::SetPanGestureMaximumPredictionAmount( unsigned int amount )
182 {
183   mPanGestureMaxPredictionAmount = amount;
184 }
185
186 void EnvironmentOptions::SetPanGestureMinimumPredictionAmount( unsigned int amount )
187 {
188   mPanGestureMinPredictionAmount = amount;
189 }
190
191 void EnvironmentOptions::SetPanGesturePredictionAmountAdjustment( unsigned int amount )
192 {
193   mPanGesturePredictionAmountAdjustment = amount;
194 }
195
196 void EnvironmentOptions::SetPanGestureSmoothingMode( unsigned int mode )
197 {
198   mPanGestureSmoothingMode = mode;
199 }
200
201 void EnvironmentOptions::SetPanGestureSmoothingAmount( float amount )
202 {
203   mPanGestureSmoothingAmount = amount;
204 }
205
206 void EnvironmentOptions::SetMinimumPanDistance( int distance )
207 {
208   mPanMinimumDistance = distance;
209 }
210
211 void EnvironmentOptions::SetMinimumPanEvents( int events )
212 {
213   mPanMinimumEvents = events;
214 }
215
216 void EnvironmentOptions::SetGlesCallTime( int time )
217 {
218   mGlesCallTime = time;
219 }
220
221 int EnvironmentOptions::GetGlesCallTime() const
222 {
223   return mGlesCallTime;
224 }
225
226 void EnvironmentOptions::SetWindowWidth( int width )
227 {
228   mWindowWidth = width;
229 }
230
231 void EnvironmentOptions::SetWindowHeight( int height )
232 {
233   mWindowHeight = height;
234 }
235
236 bool EnvironmentOptions::PerformanceServerRequired() const
237 {
238   return ( (GetPerformanceStatsLoggingOptions() > 0) ||
239            ( GetPerformanceTimeStampOutput() > 0 ) );
240 }
241
242 } // Adaptor
243
244 } // Internal
245
246 } // Dali