From 3524191f9c1a00af0ae2043d79a8f43545557599 Mon Sep 17 00:00:00 2001 From: Julien Heanley Date: Fri, 30 May 2014 10:34:27 +0100 Subject: [PATCH] Pan Gesture Prediction - Added DALI_PAN_GESTURE_PREDICTION_AMOUNT environment variable 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 --- adaptors/base/environment-options.cpp | 16 ++++++++++++++++ adaptors/base/environment-options.h | 15 ++++++++++++++- adaptors/base/environment-variables.h | 2 ++ adaptors/tizen/internal/common/adaptor-impl.cpp | 9 +++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/adaptors/base/environment-options.cpp b/adaptors/base/environment-options.cpp index 7740908..6855d52 100644 --- a/adaptors/base/environment-options.cpp +++ b/adaptors/base/environment-options.cpp @@ -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 diff --git a/adaptors/base/environment-options.h b/adaptors/base/environment-options.h index 3cb893c..5376f9e 100644 --- a/adaptors/base/environment-options.h +++ b/adaptors/base/environment-options.h @@ -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; diff --git a/adaptors/base/environment-variables.h b/adaptors/base/environment-variables.h index 5b88b20..d6f2966 100644 --- a/adaptors/base/environment-variables.h +++ b/adaptors/base/environment-variables.h @@ -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 diff --git a/adaptors/tizen/internal/common/adaptor-impl.cpp b/adaptors/tizen/internal/common/adaptor-impl.cpp index e56de30..157dd0d 100644 --- a/adaptors/tizen/internal/common/adaptor-impl.cpp +++ b/adaptors/tizen/internal/common/adaptor-impl.cpp @@ -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() -- 2.7.4