Pan Gesture Prediction - Added DALI_PAN_GESTURE_PREDICTION_AMOUNT environment variable
authorJulien Heanley <j.heanley@partner.samsung.com>
Fri, 30 May 2014 09:34:27 +0000 (10:34 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 10 Jun 2014 15:44:42 +0000 (16:44 +0100)
Increase how far pan gestures try to predict position 1.0f is 1 frame further ahead. Can use decimals like 0.6 or 1.3.

Change-Id: Ib4cb8dbbd3367374e8c26f586be8b3e387e71e79
Signed-off-by: Julien Heanley <j.heanley@partner.samsung.com>
adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/tizen/internal/common/adaptor-impl.cpp

index 7740908..6855d52 100644 (file)
@@ -33,6 +33,7 @@ EnvironmentOptions::EnvironmentOptions()
   mPerformanceLoggingLevel(0),
   mPanGestureLoggingLevel(0),
   mPanGesturePredictionMode(-1),
+  mPanGesturePredictionAmount(-1.0f), ///< only sets value in pan gesture if greater than 0
   mLogFunction( NULL )
 {
 }
@@ -89,6 +90,21 @@ unsigned int EnvironmentOptions::GetPanGestureSmoothingMode() const
   return mPanGesturePredictionMode;
 }
 
+float EnvironmentOptions::GetPanGesturePredictionAmount() const
+{
+  return mPanGesturePredictionAmount;
+}
+
+void EnvironmentOptions::SetPanGesturePredictionMode(unsigned int mode)
+{
+  mPanGesturePredictionMode = mode;
+}
+
+void EnvironmentOptions::SetPanGesturePredictionAmount(float amount)
+{
+  mPanGesturePredictionAmount = amount;
+}
+
 } // Adaptor
 
 } // Internal
index 3cb893c..5376f9e 100644 (file)
@@ -95,11 +95,23 @@ public:
   unsigned int GetPanGestureSmoothingMode() const;
 
   /**
+   * @return pan-gesture prediction amount
+   */
+  float GetPanGesturePredictionAmount() const;
+
+  /**
    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
    *
    * @param[in] mode The smoothing mode to use
    */
-  void SetPanGesturePredictionMode(unsigned int mode) { mPanGesturePredictionMode = mode; }
+  void SetPanGesturePredictionMode(unsigned int mode);
+
+  /**
+   * @brief Sets the prediction amount of the pan gesture
+   *
+   * @param[in] amount The prediction amount, 0.0f being next vsync and each 1.0f on top is another vsync ahead, can be divisions of (0.5f)
+   */
+  void SetPanGesturePredictionAmount(float amount);
 
 private:
 
@@ -108,6 +120,7 @@ private:
   unsigned int mPerformanceLoggingLevel;          ///< performance log level
   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
   int mPanGesturePredictionMode;                  ///< prediction mode for pan gestures
+  float mPanGesturePredictionAmount;              ///< prediction amount for pan gestures
 
   Dali::Integration::Log::LogFunction mLogFunction;
 
index 5b88b20..d6f2966 100644 (file)
@@ -33,6 +33,8 @@ namespace Adaptor
 
 #define DALI_ENV_PAN_PREDICTION_MODE "DALI_PAN_PREDICTION_MODE"
 
+#define DALI_ENV_PAN_PREDICTION_AMOUNT "DALI_PAN_PREDICTION_AMOUNT"
+
 } // namespace Adaptor
 
 } // namespace Internal
index e56de30..157dd0d 100644 (file)
@@ -144,6 +144,11 @@ void Adaptor::ParseEnvironmentOptions()
   {
     mEnvironmentOptions.SetPanGesturePredictionMode(predictionMode);
   }
+  float predictionAmount = -1.0f;
+  if( GetFloatEnvironmentVariable(DALI_ENV_PAN_PREDICTION_AMOUNT, predictionAmount) )
+  {
+    mEnvironmentOptions.SetPanGesturePredictionAmount(predictionAmount);
+  }
 
   mEnvironmentOptions.InstallLogFunction();
 }
@@ -192,6 +197,10 @@ void Adaptor::Initialize()
   {
     Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGestureSmoothingMode());
   }
+  if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0.0f )
+  {
+    Integration::SetPanGesturePredictionAmount(mEnvironmentOptions.GetPanGesturePredictionAmount());
+  }
 }
 
 Adaptor::~Adaptor()