[3.0] pan-gesture code refactor and environment variables
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.h
index 63c2f34..a677d2e 100644 (file)
@@ -1,24 +1,29 @@
 #ifndef __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
 #define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
+// EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
+// INTERNAL INCLUDES
+#include <base/threading-mode.h>
+
 namespace Dali
 {
 namespace Internal
@@ -27,7 +32,9 @@ namespace Adaptor
 {
 
 /**
- * Contains environment options which define settings and the ability to install a log function.
+ * This class provides the environment options which define settings as well as
+ * the ability to install a log function.
+ *
  */
 class EnvironmentOptions
 {
@@ -46,17 +53,8 @@ public:
 
   /**
    * @param logFunction logging function
-   * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
-   * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
-   * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
-   * @param logPerformanceLevel performance logging, 0 = disabled,  1+ =  enabled
-   * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
    */
-  void SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
-                       unsigned int logFrameRateFrequency,
-                       unsigned int logupdateStatusFrequency,
-                       unsigned int logPerformanceLevel,
-                       unsigned int logPanGestureLevel );
+  void SetLogFunction( const Dali::Integration::Log::LogFunction& logFunction );
 
   /**
    * Install the log function for the current thread.
@@ -69,6 +67,11 @@ public:
   void UnInstallLogFunction() const;
 
   /**
+   * @return whether network control is enabled or not ( 0 = off, 1 = on )
+   */
+  unsigned int GetNetworkControlMode() const;
+
+  /**
    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
    */
   unsigned int GetFrameRateLoggingFrequency() const;
@@ -79,9 +82,24 @@ public:
   unsigned int GetUpdateStatusLoggingFrequency() const;
 
   /**
-   * @return logPerformanceLevel performance log level ( 0 = off )
+   * @return object profiler status interval ( 0 == off )
+   */
+  unsigned int GetObjectProfilerInterval() const;
+
+  /**
+   * @return performance statistics log level ( 0 == off )
+   */
+  unsigned int GetPerformanceStatsLoggingOptions() const;
+
+  /**
+   * @return performance statistics log frequency in seconds
    */
-  unsigned int GetPerformanceLoggingLevel() const;
+  unsigned int GetPerformanceStatsLoggingFrequency() const;
+
+  /**
+   * @return performance time stamp output ( 0 == off)
+   */
+  unsigned int GetPerformanceTimeStampOutput() const;
 
   /**
    * @return pan-gesture logging level ( 0 == off )
@@ -89,24 +107,187 @@ public:
   unsigned int GetPanGestureLoggingLevel() const;
 
   /**
-   * @return pan-gesture smoothing mode ( 0 == no smoothing )
+   * @return pan-gesture prediction mode ( -1 means not set so no prediction, 0 = no prediction )
+   */
+  int GetPanGesturePredictionMode() const;
+
+  /**
+   * @return pan-gesture prediction amount
+   */
+  int GetPanGesturePredictionAmount() const;
+
+  /**
+   * @return maximum pan-gesture prediction amount
+   */
+  int GetPanGestureMaximumPredictionAmount() const;
+
+  /**
+   * @return minimum pan-gesture prediction amount
    */
-  unsigned int GetPanGestureSmoothingMode() const;
+  int GetPanGestureMinimumPredictionAmount() const;
 
   /**
-   * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
+   * @brief Gets the prediction amount to adjust when the pan velocity is changed.
    *
-   * @param[in] mode The smoothing mode to use
+   * If the pan velocity is accelerating, the prediction amount will be increased
+   * by the specified amount until it reaches the upper bound. If the pan velocity
+   * is decelerating, the prediction amount will be decreased by the specified
+   * amount until it reaches the lower bound.
+   *
+   * @return pan-gesture prediction amount adjustment
+   */
+  int GetPanGesturePredictionAmountAdjustment() const;
+
+  /**
+   * @return pan-gesture smoothing mode ( -1 means not set so no smoothing, 0 = no smoothing )
+   */
+  int GetPanGestureSmoothingMode() const;
+
+  /**
+   * @return pan-gesture smoothing amount
+   */
+  float GetPanGestureSmoothingAmount() const;
+
+  /**
+   * @return pan-gesture use actual times is true if real gesture and frame times are to be used.
+   */
+  int GetPanGestureUseActualTimes() const;
+
+  /**
+   * @return pan-gesture interpolation time range is the time range (ms) of past points to use (with weights) when interpolating.
+   */
+  int GetPanGestureInterpolationTimeRange() const;
+
+  /**
+   * @return pan-gesture scalar only prediction, when enabled, ignores acceleration.
+   */
+  int GetPanGestureScalarOnlyPredictionEnabled() const;
+
+  /**
+   * @return pan-gesture two point prediction combines two interpolated points to get more steady acceleration and velocity values.
+   */
+  int GetPanGestureTwoPointPredictionEnabled() const;
+
+  /**
+   * @return pan-gesture two point interpolate past time is the time delta (ms) in the past to interpolate the second point.
+   */
+  int GetPanGestureTwoPointInterpolatePastTime() const;
+
+  /**
+   * @return pan-gesture two point velocity bias is the ratio of first and second points to use for velocity.
+   * 0.0f = 100% of first point. 1.0f = 100% of second point.
+   */
+  float GetPanGestureTwoPointVelocityBias() const;
+
+  /**
+   * @return pan-gesture two point acceleration bias is the ratio of first and second points to use for acceleration.
+   * 0.0f = 100% of first point. 1.0f = 100% of second point.
+   */
+  float GetPanGestureTwoPointAccelerationBias() const;
+
+  /**
+   * @return pan-gesture multitap smoothing range is the range in time (ms) of points in the history to smooth the final output against.
+   */
+  int GetPanGestureMultitapSmoothingRange() const;
+
+  /**
+   * @return The minimum distance before a pan can be started (-1 means it's not set)
+   */
+  int GetMinimumPanDistance() const;
+
+  /**
+   * @return The minimum events before a pan can be started (-1 means it's not set)
+   */
+  int GetMinimumPanEvents() const;
+
+  /**
+   * @return The width of the window
+   */
+  unsigned int GetWindowWidth() const;
+
+  /**
+   * @return The height of the window
+   */
+  unsigned int GetWindowHeight() const;
+
+  /**
+   * @brief Get the graphics status time
+   */
+  int GetGlesCallTime() const;
+
+  /**
+   * @brief Get whether or not to accumulate gles call statistics
+   */
+  bool GetGlesCallAccumulate() const;
+
+  /**
+   * @return true if performance server is required
+   */
+  bool PerformanceServerRequired() const;
+
+  /**
+   * @return Gets the window name.
+   */
+  const std::string& GetWindowName() const;
+
+  /**
+   * @return Gets the window class.
+   */
+  const std::string& GetWindowClassName() const;
+
+  /**
+   * @return The thread mode that DALi should use.
+   */
+  ThreadingMode::Type GetThreadingMode() const;
+
+  /**
+   * @return The render refresh rate.
+   */
+  unsigned int GetRenderRefreshRate() const;
+
+private: // Internal
+
+  /**
+   * Parses the environment options.
+   * Called from the constructor
    */
-  void SetPanGesturePredictionMode(unsigned int mode) { mPanGesturePredictionMode = mode; }
+  void ParseEnvironmentOptions();
 
-private:
+private: // Data
 
+  std::string mWindowName;                        ///< name of the window
+  std::string mWindowClassName;                   ///< name of the class the window belongs to
+  unsigned int mNetworkControl;                   ///< whether network control is enabled
   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
-  unsigned int mPerformanceLoggingLevel;          ///< performance log level
+  unsigned int mObjectProfilerInterval;           ///< how often object counts are logged out in seconds
+  unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
+  unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
+  unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
-  unsigned int mPanGesturePredictionMode;         ///< prediction mode for pan gestures
+  int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
+  int mPanGesturePredictionAmount;                ///< prediction amount for pan gestures
+  int mPanGestureMaxPredictionAmount;             ///< maximum prediction amount for pan gestures
+  int mPanGestureMinPredictionAmount;             ///< minimum prediction amount for pan gestures
+  int mPanGesturePredictionAmountAdjustment;      ///< adjustment of prediction amount for pan gestures
+  int mPanGestureSmoothingMode;                   ///< prediction mode for pan gestures
+  float mPanGestureSmoothingAmount;               ///< prediction amount for pan gestures
+  int mPanGestureUseActualTimes;                  ///< Disable to optionally override actual times if they make results worse.
+  int mPanGestureInterpolationTimeRange;          ///< Time into past history (ms) to use points to interpolate the first point.
+  int mPanGestureScalarOnlyPredictionEnabled;     ///< If enabled, prediction is done using velocity alone (no integration or acceleration).
+  int mPanGestureTwoPointPredictionEnabled;       ///< If enabled, a second interpolated point is predicted and combined with the first to get more stable values.
+  int mPanGestureTwoPointInterpolatePastTime;     ///< The target time in the past to generate the second interpolated point.
+  float mPanGestureTwoPointVelocityBias;          ///< The ratio of first and second interpolated points to use for velocity. 0.0f = 100% of first point. 1.0f = 100% of second point.
+  float mPanGestureTwoPointAccelerationBias;      ///< The ratio of first and second interpolated points to use for acceleration. 0.0f = 100% of first point. 1.0f = 100% of second point.
+  int mPanGestureMultitapSmoothingRange;          ///< The range in time (ms) of points in the history to smooth the final output against.
+  int mPanMinimumDistance;                        ///< minimum distance required before pan starts
+  int mPanMinimumEvents;                          ///< minimum events required before pan starts
+  int mGlesCallTime;                              ///< time in seconds between status updates
+  unsigned int mWindowWidth;                      ///< width of the window
+  unsigned int mWindowHeight;                     ///< height of the window
+  ThreadingMode::Type mThreadingMode;             ///< threading mode
+  unsigned int mRenderRefreshRate;                ///< render refresh rate
+  bool mGlesCallAccumulate;                       ///< Whether or not to accumulate gles call statistics
 
   Dali::Integration::Log::LogFunction mLogFunction;