From 4799cbda311480b0c1e8d8725aac532c64bede9b Mon Sep 17 00:00:00 2001 From: Julien Heanley Date: Wed, 2 Jul 2014 08:30:20 +0100 Subject: [PATCH] Pan Gesture Cleanup Move functions from profiling.h/cpp to new files input-options.h/cpp Removed backwards compatible pan gesture environment variable code since homescreen already has patch for new ones Correct references to old environment values Change-Id: I5eb2b75fce7d4f57fa0dd4e38c3c3942379ac2b2 Signed-off-by: Adeel Kazmi --- dali/integration-api/file.list | 2 + dali/integration-api/input-options.cpp | 41 ++++++++++++++ dali/integration-api/input-options.h | 66 ++++++++++++++++++++++ dali/integration-api/profiling.cpp | 24 -------- dali/integration-api/profiling.h | 30 ---------- dali/internal/event/events/pan-gesture-processor.h | 4 +- 6 files changed, 110 insertions(+), 57 deletions(-) create mode 100644 dali/integration-api/input-options.cpp create mode 100644 dali/integration-api/input-options.h diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 65b2e26..380988a 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -7,6 +7,7 @@ platform_abstraction_src_files = \ $(platform_abstraction_src_dir)/image-data.cpp \ $(platform_abstraction_src_dir)/debug.cpp \ $(platform_abstraction_src_dir)/profiling.cpp \ + $(platform_abstraction_src_dir)/input-options.cpp \ $(platform_abstraction_src_dir)/shader-data.cpp \ $(platform_abstraction_src_dir)/system-overlay.cpp \ $(platform_abstraction_src_dir)/common/lockless-buffer.cpp \ @@ -26,6 +27,7 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/glyph-set.h \ $(platform_abstraction_src_dir)/debug.h \ $(platform_abstraction_src_dir)/profiling.h \ + $(platform_abstraction_src_dir)/input-options.h \ $(platform_abstraction_src_dir)/bitmap.h \ $(platform_abstraction_src_dir)/image-data.h \ $(platform_abstraction_src_dir)/resource-types.h \ diff --git a/dali/integration-api/input-options.cpp b/dali/integration-api/input-options.cpp new file mode 100644 index 0000000..2efe516 --- /dev/null +++ b/dali/integration-api/input-options.cpp @@ -0,0 +1,41 @@ +#include "input-options.h" + +#include +#include + +using Dali::Internal::GestureEventProcessor; +using Dali::Internal::ThreadLocalStorage; + +namespace Dali +{ + +namespace Integration +{ + +void SetPanGesturePredictionMode( int mode ) +{ + GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); + eventProcessor.SetPanGesturePredictionMode(mode); +} + +void SetPanGesturePredictionAmount(unsigned int amount) +{ + GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); + eventProcessor.SetPanGesturePredictionAmount(amount); +} + +void SetPanGestureSmoothingMode(int mode) +{ + GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); + eventProcessor.SetPanGestureSmoothingMode(mode); +} + +void SetPanGestureSmoothingAmount( float amount ) +{ + GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); + eventProcessor.SetPanGestureSmoothingAmount(amount); +} + +} // namespace Integration + +} // namespace Dali diff --git a/dali/integration-api/input-options.h b/dali/integration-api/input-options.h new file mode 100644 index 0000000..9b8458e --- /dev/null +++ b/dali/integration-api/input-options.h @@ -0,0 +1,66 @@ +#ifndef __DALI_INTEGRATION_INPUT_OPTIONS_H__ +#define __DALI_INTEGRATION_INPUT_OPTIONS_H__ + +/* + * Copyright (c) 2014 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 + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Integration +{ + +/** + * @brief Called by adaptor to set the pan gesture prediction mode from + * an environment variable + * + * @pre Should be called after Core creation. + * @param mode The pan gesture prediction mode. + */ +DALI_IMPORT_API void SetPanGesturePredictionMode( int mode ); + +/** + * @brief Called by adaptor to set the prediction amount of the pan gesture from an environment variable + * + * @param[in] amount The prediction amount in milliseconds + */ +DALI_IMPORT_API void SetPanGesturePredictionAmount(unsigned int amount); + +/** + * @brief Called to set how pan gestures smooth input + * + * @param[in] mode The smoothing mode to use + */ +DALI_IMPORT_API void SetPanGestureSmoothingMode( int mode ); + +/** + * @brief Sets the prediction amount of the pan gesture + * + * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing + */ +DALI_IMPORT_API void SetPanGestureSmoothingAmount( float amount ); + +} // namespace Integration + +} // namespace Dali + +#endif // __DALI_INTEGRATION_INPUT_OPTIONS_H__ diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index 29c4d31..4343fe5 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.cpp @@ -105,30 +105,6 @@ void EnableProfiling( ProfilingType type ) } } -void SetPanGesturePredictionMode( int mode ) -{ - GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); - eventProcessor.SetPanGesturePredictionMode(mode); -} - -void SetPanGesturePredictionAmount(unsigned int amount) -{ - GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); - eventProcessor.SetPanGesturePredictionAmount(amount); -} - -void SetPanGestureSmoothingMode(int mode) -{ - GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); - eventProcessor.SetPanGestureSmoothingMode(mode); -} - -void SetPanGestureSmoothingAmount( float amount ) -{ - GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor(); - eventProcessor.SetPanGestureSmoothingAmount(amount); -} - namespace Profiling { diff --git a/dali/integration-api/profiling.h b/dali/integration-api/profiling.h index be348ba..464da30 100644 --- a/dali/integration-api/profiling.h +++ b/dali/integration-api/profiling.h @@ -44,36 +44,6 @@ enum ProfilingType */ DALI_IMPORT_API void EnableProfiling( ProfilingType type ); -/** - * @brief Called by adaptor to set the pan gesture prediction mode from - * an environment variable - * - * @pre Should be called after Core creation. - * @param mode The pan gesture prediction mode. - */ -DALI_IMPORT_API void SetPanGesturePredictionMode( int mode ); - -/** - * @brief Called by adaptor to set the prediction amount of the pan gesture from an environment variable - * - * @param[in] amount The prediction amount in milliseconds - */ -DALI_IMPORT_API void SetPanGesturePredictionAmount(unsigned int amount); - -/** - * @brief Called to set how pan gestures smooth input - * - * @param[in] mode The smoothing mode to use - */ -DALI_IMPORT_API void SetPanGestureSmoothingMode( int mode ); - -/** - * @brief Sets the prediction amount of the pan gesture - * - * @param[in] amount The smoothing amount [0.0f,1.0f] - 0.0f would be no smoothing, 1.0f maximum smoothing - */ -DALI_IMPORT_API void SetPanGestureSmoothingAmount( float amount ); - namespace Profiling { diff --git a/dali/internal/event/events/pan-gesture-processor.h b/dali/internal/event/events/pan-gesture-processor.h index 2691405..60fab3e 100644 --- a/dali/internal/event/events/pan-gesture-processor.h +++ b/dali/internal/event/events/pan-gesture-processor.h @@ -120,9 +120,7 @@ public: // To be called by GestureEventProcessor * * Valid modes: * 0 - No prediction - * 1 - Average Smoothing (no actual prediction) - * 2 - Interpolation using last vsync time and event time - * 3 - Same as 2 for now, in progress + * 1 - Prediction using average acceleration */ void SetPredictionMode(int mode); -- 2.7.4