[dali_1.0.31] Merge branch 'tizen'
[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 class EnvironmentOptions
35 {
36
37 public:
38
39   /**
40    * Constructor
41    */
42   EnvironmentOptions();
43
44   /**
45    * non-virtual destructor, not intended as a base class
46    */
47   ~EnvironmentOptions();
48
49   /**
50    * @param logFunction logging function
51    * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
52    * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
53    * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
54    * @param logPerformanceStats performance statistics logging, 0 = disabled,  1+ =  enabled
55    * @param logPerformanceStatsFrequency statistics logging frequency in seconds
56    * @param performanceTimeStampOutput where to output performance related time stamps to
57    * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
58    */
59   void 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   /**
68    * Install the log function for the current thread.
69    */
70   void InstallLogFunction() const;
71
72   /**
73    * Un-install the log function for the current thread.
74    */
75   void UnInstallLogFunction() const;
76
77   /**
78    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
79    */
80   unsigned int GetFrameRateLoggingFrequency() const;
81
82   /**
83    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
84    */
85   unsigned int GetUpdateStatusLoggingFrequency() const;
86
87   /**
88    * @return performance statistics log level ( 0 == off )
89    */
90   unsigned int GetPerformanceStatsLoggingOptions() const;
91
92   /**
93    * @return performance statistics log frequency in seconds
94    */
95   unsigned int GetPerformanceStatsLoggingFrequency() const;
96
97   /**
98    * @return performance time stamp output ( 0 == off)
99    */
100   unsigned int GetPerformanceTimeStampOutput() const;
101
102   /**
103    * @return pan-gesture logging level ( 0 == off )
104    */
105   unsigned int GetPanGestureLoggingLevel() const;
106
107   /**
108    * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
109    */
110   int GetPanGesturePredictionMode() const;
111
112   /**
113    * @return pan-gesture prediction amount
114    */
115   int GetPanGesturePredictionAmount() const;
116
117   /**
118    * @return maximum pan-gesture prediction amount
119    */
120   int GetPanGestureMaximumPredictionAmount() const;
121
122   /**
123    * @return minimum pan-gesture prediction amount
124    */
125   int GetPanGestureMinimumPredictionAmount() const;
126
127   /**
128    * @return pan-gesture prediction amount adjustment
129    */
130   int GetPanGesturePredictionAmountAdjustment() const;
131
132   /**
133    * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
134    */
135   int GetPanGestureSmoothingMode() const;
136
137   /**
138    * @return pan-gesture smoothing amount
139    */
140   float GetPanGestureSmoothingAmount() const;
141
142   /**
143    * @return The minimum distance before a pan can be started (-1 means it's not set)
144    */
145   int GetMinimumPanDistance() const;
146
147   /**
148    * @return The minimum events before a pan can be started (-1 means it's not set)
149    */
150   int GetMinimumPanEvents() const;
151
152   /**
153    * @brief Sets the mode used to predict pan gesture movement
154    *
155    * @param[in] mode The prediction mode to use
156    */
157   void SetPanGesturePredictionMode( unsigned int mode );
158
159   /**
160    * @brief Sets the prediction amount of the pan gesture
161    *
162    * @param[in] amount The prediction amount in milliseconds
163    */
164   void SetPanGesturePredictionAmount( unsigned int amount );
165
166   /**
167    * @brief Sets the upper bound of the prediction amount for clamping
168    *
169    * @param[in] amount The prediction amount in milliseconds
170    */
171   void SetPanGestureMaximumPredictionAmount( unsigned int amount );
172
173   /**
174    * @brief Sets the lower bound of the prediction amount for clamping
175    *
176    * @param[in] amount The prediction amount in milliseconds
177    */
178   void SetPanGestureMinimumPredictionAmount( unsigned int amount );
179
180   /**
181    * @brief Sets the prediction amount to adjust when the pan velocity is changed.
182    * If the pan velocity is accelerating, the prediction amount will be increased
183    * by the specified amount until it reaches the upper bound. If the pan velocity
184    * is decelerating, the prediction amount will be decreased by the specified
185    * amount until it reaches the lower bound.
186    *
187    * @param[in] amount The prediction amount in milliseconds
188    */
189   void SetPanGesturePredictionAmountAdjustment( unsigned int amount );
190
191   /**
192    * @brief Called to set how pan gestures smooth input
193    *
194    * @param[in] mode The smoothing mode to use
195    */
196   void SetPanGestureSmoothingMode( unsigned int mode );
197
198   /**
199    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
200    *
201    * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing
202    */
203   void SetPanGestureSmoothingAmount( float amount );
204
205   /**
206    * @brief Sets the minimum distance required before a pan starts
207    *
208    * @param[in] distance The minimum distance before a pan starts
209    */
210   void SetMinimumPanDistance( int distance );
211
212   /**
213    * @brief Sets the minimum number of events required before a pan starts
214    *
215    * @param[in] events The minimum events before a pan starts
216    */
217   void SetMinimumPanEvents( int events );
218
219   /**
220    * @brief Sets how often the gles call logging occurs
221    *
222    * @param[in] time the number of seconds between logging output
223    */
224   void SetGlesCallTime( int time );
225
226   /**
227    * @brief Get the graphics status time
228    */
229   int GetGlesCallTime() const;
230
231   /**
232    * @return true if performance server is required
233    */
234   bool PerformanceServerRequired() const;
235
236 private:
237
238   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
239   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
240   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
241   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
242   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
243   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
244   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
245   int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
246   int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
247   int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
248   int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
249   int mPanGestureSmoothingMode;                  ///< prediction mode for pan gestures
250   float mPanGestureSmoothingAmount;              ///< prediction amount for pan gestures
251   int mPanMinimumDistance;                        ///< minimum distance required before pan starts
252   int mPanMinimumEvents;                          ///< minimum events required before pan starts
253   int mGlesCallTime;                              ///< time in seconds between status updates
254
255   Dali::Integration::Log::LogFunction mLogFunction;
256
257   // Undefined copy constructor.
258   EnvironmentOptions( const EnvironmentOptions& );
259
260   // Undefined assignment operator.
261   EnvironmentOptions& operator=( const EnvironmentOptions& );
262
263 };
264
265 } // Adaptor
266 } // Internal
267 } // Dali
268
269 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__