Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
2 #define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Adaptor
29 {
30
31 /**
32  * Contains environment options which define settings and the ability to install a log function.
33  *
34  * TODO: This file and adaptor needs cleaning up. There should not be any environment options in the adaptor class, only here!
35  */
36 class EnvironmentOptions
37 {
38
39 public:
40
41   /**
42    * Constructor
43    */
44   EnvironmentOptions();
45
46   /**
47    * non-virtual destructor, not intended as a base class
48    */
49   ~EnvironmentOptions();
50
51   /**
52    * @param logFunction logging function
53    * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
54    * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
55    * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
56    * @param logPerformanceStats performance statistics logging, 0 = disabled,  1+ =  enabled
57    * @param logPerformanceStatsFrequency statistics logging frequency in seconds
58    * @param performanceTimeStampOutput where to output performance related time stamps to
59    * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
60    */
61   void 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   /**
70    * Install the log function for the current thread.
71    */
72   void InstallLogFunction() const;
73
74   /**
75    * Un-install the log function for the current thread.
76    */
77   void UnInstallLogFunction() const;
78
79   /**
80    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
81    */
82   unsigned int GetFrameRateLoggingFrequency() const;
83
84   /**
85    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
86    */
87   unsigned int GetUpdateStatusLoggingFrequency() const;
88
89   /**
90    * @return performance statistics log level ( 0 == off )
91    */
92   unsigned int GetPerformanceStatsLoggingOptions() const;
93
94   /**
95    * @return performance statistics log frequency in seconds
96    */
97   unsigned int GetPerformanceStatsLoggingFrequency() const;
98
99   /**
100    * @return performance time stamp output ( 0 == off)
101    */
102   unsigned int GetPerformanceTimeStampOutput() const;
103
104   /**
105    * @return pan-gesture logging level ( 0 == off )
106    */
107   unsigned int GetPanGestureLoggingLevel() const;
108
109   /**
110    * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
111    */
112   int GetPanGesturePredictionMode() const;
113
114   /**
115    * @return pan-gesture prediction amount
116    */
117   int GetPanGesturePredictionAmount() const;
118
119   /**
120    * @return maximum pan-gesture prediction amount
121    */
122   int GetPanGestureMaximumPredictionAmount() const;
123
124   /**
125    * @return minimum pan-gesture prediction amount
126    */
127   int GetPanGestureMinimumPredictionAmount() const;
128
129   /**
130    * @return pan-gesture prediction amount adjustment
131    */
132   int GetPanGesturePredictionAmountAdjustment() const;
133
134   /**
135    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
136    */
137   int GetPanGestureSmoothingMode() const;
138
139   /**
140    * @return pan-gesture smoothing amount
141    */
142   float GetPanGestureSmoothingAmount() const;
143
144   /**
145    * @return The minimum distance before a pan can be started (-1 means it's not set)
146    */
147   int GetMinimumPanDistance() const;
148
149   /**
150    * @return The minimum events before a pan can be started (-1 means it's not set)
151    */
152   int GetMinimumPanEvents() const;
153
154   /**
155    * @return The width of the window
156    */
157   unsigned int GetWindowWidth() const;
158
159   /**
160    * @return The height of the window
161    */
162   unsigned int GetWindowHeight() const;
163
164   /**
165    * @brief Sets the mode used to predict pan gesture movement
166    *
167    * @param[in] mode The prediction mode to use
168    */
169   void SetPanGesturePredictionMode( unsigned int mode );
170
171   /**
172    * @brief Sets the prediction amount of the pan gesture
173    *
174    * @param[in] amount The prediction amount in milliseconds
175    */
176   void SetPanGesturePredictionAmount( unsigned int amount );
177
178   /**
179    * @brief Sets the upper bound of the prediction amount for clamping
180    *
181    * @param[in] amount The prediction amount in milliseconds
182    */
183   void SetPanGestureMaximumPredictionAmount( unsigned int amount );
184
185   /**
186    * @brief Sets the lower bound of the prediction amount for clamping
187    *
188    * @param[in] amount The prediction amount in milliseconds
189    */
190   void SetPanGestureMinimumPredictionAmount( unsigned int amount );
191
192   /**
193    * @brief Sets the prediction amount to adjust when the pan velocity is changed.
194    * If the pan velocity is accelerating, the prediction amount will be increased
195    * by the specified amount until it reaches the upper bound. If the pan velocity
196    * is decelerating, the prediction amount will be decreased by the specified
197    * amount until it reaches the lower bound.
198    *
199    * @param[in] amount The prediction amount in milliseconds
200    */
201   void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
202
203   /**
204    * @brief Called to set how pan gestures smooth input
205    *
206    * @param[in] mode The smoothing mode to use
207    */
208   void SetPanGestureSmoothingMode( unsigned int mode );
209
210   /**
211    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
212    *
213    * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
214    */
215   void SetPanGestureSmoothingAmount( float amount );
216
217   /**
218    * @brief Sets the minimum distance required before a pan starts
219    *
220    * @param[in] distance The minimum distance before a pan starts
221    */
222   void SetMinimumPanDistance( int distance );
223
224   /**
225    * @brief Sets the minimum number of events required before a pan starts
226    *
227    * @param[in] events The minimum events before a pan starts
228    */
229   void SetMinimumPanEvents( int events );
230
231   /**
232    * @brief Sets how often the gles call logging occurs
233    *
234    * @param[in] time the number of seconds between logging output
235    */
236   void SetGlesCallTime( int time );
237
238   /**
239    * @brief Get the graphics status time
240    */
241   int GetGlesCallTime() const;
242
243   /**
244    * @brief Sets the width of the window
245    */
246   void SetWindowWidth( int width );
247
248   /**
249    * @brief Sets the width of the window
250    */
251   void SetWindowHeight( int height );
252
253   /**
254    * @return true if performance server is required
255    */
256   bool PerformanceServerRequired() const;
257
258 private:
259
260   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
261   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
262   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
263   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
264   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
265   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
266   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
267   int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
268   int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
269   int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
270   int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
271   int mPanGestureSmoothingMode;                   ///< prediction mode for pan gestures
272   float mPanGestureSmoothingAmount;               ///< prediction amount for pan gestures
273   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
274   int mPanMinimumEvents;                          ///< minimum events required before pan starts
275   int mGlesCallTime;                              ///< time in seconds between status updates
276   unsigned int mWindowWidth;                      ///< width of the window
277   unsigned int mWindowHeight;                     ///< height of the window
278
279   Dali::Integration::Log::LogFunction mLogFunction;
280
281   // Undefined copy constructor.
282   EnvironmentOptions( const EnvironmentOptions& );
283
284   // Undefined assignment operator.
285   EnvironmentOptions& operator=( const EnvironmentOptions& );
286
287 };
288
289 } // Adaptor
290 } // Internal
291 } // Dali
292
293 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__