From 8e43ee5250cc6cc54171ab9c9552407ac4904e0a Mon Sep 17 00:00:00 2001 From: Eunmi Lee Date: Mon, 1 Apr 2013 16:19:22 +0900 Subject: [PATCH] Remove codes to process flick more using decimals. [Title] Remove codes to process flick more using decimals. [Issue#] N/A [Problem] It seems that flick is stopped, but flick is processing slowly, and it caused that channel scrolling seems to work incorrectly. [Cause] The flick is processed using decimals. [Solution] Remove codes to process flick more using decimals. Change-Id: Ia47a193b044a46cf2db9f4a972bfdd1fd8eada50 --- Source/WebKit2/UIProcess/API/efl/tizen/Flick.cpp | 34 +++++------------------- Source/WebKit2/UIProcess/API/efl/tizen/Flick.h | 1 - 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/Flick.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/Flick.cpp index 8db8c71..015d2cb 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/Flick.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/Flick.cpp @@ -64,7 +64,6 @@ void Flick::start(IntPoint velocity) m_flickIndex = 0; m_flickDuration = 1 / ecore_animator_frametime_get(); m_flickAnimator = ecore_animator_add(flickAnimatorCallback, this); - m_remainder = IntPoint(); } void Flick::stop() @@ -93,33 +92,15 @@ Eina_Bool Flick::flickAnimatorCallback(void* data) bool Flick::process() { - double valueOfEaseInOutCubic = easeInOutQuad(m_flickDuration, m_flickIndex); - double decimalDeltaX = -1 * m_velocity.x() / m_flickDuration * valueOfEaseInOutCubic + m_remainder.x(); - double decimalDeltaY = -1 * m_velocity.y() / m_flickDuration * valueOfEaseInOutCubic + m_remainder.y(); - int deltaX = static_cast(decimalDeltaX); - int deltaY = static_cast(decimalDeltaY); - - m_remainder.setX(decimalDeltaX - deltaX); - if (m_remainder.x() >= 0.5) { - deltaX += 1; - m_remainder.setX(m_remainder.x() - 0.5); - } else if (m_remainder.x() <= -0.5) { - deltaX -= 1; - m_remainder.setX(m_remainder.x() + 0.5); - } - - m_remainder.setY(decimalDeltaY - deltaY); - if (m_remainder.y() >= 0.5) { - deltaY += 1; - m_remainder.setY(m_remainder.y() - 0.5); - } else if (m_remainder.y() <= -0.5) { - deltaY -= 1; - m_remainder.setY(m_remainder.y() + 0.5); - } + double multiplier = easeInOutQuad(m_flickDuration, m_flickIndex); + int deltaX = -1 * m_velocity.x(); + deltaX = (deltaX > 0) ? ceilf(deltaX * multiplier / m_flickDuration) : floorf(deltaX * multiplier / m_flickDuration); + int deltaY = -1 * m_velocity.y(); + deltaY = (deltaY > 0) ? ceilf(deltaY * multiplier / m_flickDuration) : floorf(deltaY * multiplier / m_flickDuration); m_flickIndex++; - if (m_flickIndex > m_flickDuration) { + if (m_flickIndex > m_flickDuration || !(deltaX || deltaY)) { m_flickAnimator = 0; #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) PageClientImpl* pageClientImpl = m_viewImpl->pageClient.get(); @@ -129,9 +110,6 @@ bool Flick::process() return false; } else { - if (!deltaX && !deltaY) - return true; - PageClientImpl* pageClientImpl = m_viewImpl->pageClient.get(); EINA_SAFETY_ON_NULL_RETURN_VAL(pageClientImpl, true); ewkViewSendScrollEvent(m_viewImpl->view(), deltaX, deltaY); diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/Flick.h b/Source/WebKit2/UIProcess/API/efl/tizen/Flick.h index db75926..a077649 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/Flick.h +++ b/Source/WebKit2/UIProcess/API/efl/tizen/Flick.h @@ -56,7 +56,6 @@ private: int m_flickIndex; int m_flickDuration; Ecore_Animator* m_flickAnimator; - WebCore::FloatPoint m_remainder; Ecore_Animator* m_scrollAnimator; WebCore::IntPoint m_scrollToPosition; static const double s_scrollSpeedFactor; // Decide a scroll speed in scrollToAnimator() -- 2.7.4