diff options
author | 2013-01-15 09:37:31 -0800 | |
---|---|---|
committer | 2013-01-15 09:37:31 -0800 | |
commit | 9e1269417020734e6996c9ad2b9b672f437f9a6a (patch) | |
tree | b9568fc6bcb614cdce459f1515a0f039c201173d /native/jni/src/proximity_info_state.cpp | |
parent | 3feef1475d7f981887db549d4db57cb71cf7cb56 (diff) | |
parent | a04fe20c7736523fc3d906aaba7d3a01bca06fc2 (diff) | |
download | latinime-9e1269417020734e6996c9ad2b9b672f437f9a6a.tar.gz latinime-9e1269417020734e6996c9ad2b9b672f437f9a6a.tar.xz latinime-9e1269417020734e6996c9ad2b9b672f437f9a6a.zip |
am a04fe20c: Merge "refactor distance cache"
* commit 'a04fe20c7736523fc3d906aaba7d3a01bca06fc2':
refactor distance cache
Diffstat (limited to 'native/jni/src/proximity_info_state.cpp')
-rw-r--r-- | native/jni/src/proximity_info_state.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index d0cc4acc2..aa029297e 100644 --- a/native/jni/src/proximity_info_state.cpp +++ b/native/jni/src/proximity_info_state.cpp @@ -101,7 +101,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi mTimes.clear(); mInputIndice.clear(); mLengthCache.clear(); - mDistanceCache.clear(); + mDistanceCache_G.clear(); mNearKeysVector.clear(); mSearchKeysVector.clear(); mSpeedRates.clear(); @@ -210,7 +210,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi const int keyCount = mProximityInfo->getKeyCount(); mNearKeysVector.resize(mSampledInputSize); mSearchKeysVector.resize(mSampledInputSize); - mDistanceCache.resize(mSampledInputSize * keyCount); + mDistanceCache_G.resize(mSampledInputSize * keyCount); for (int i = lastSavedInputSize; i < mSampledInputSize; ++i) { mNearKeysVector[i].reset(); mSearchKeysVector[i].reset(); @@ -221,7 +221,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi const int y = mSampledInputYs[i]; const float normalizedSquaredDistance = mProximityInfo->getNormalizedSquaredDistanceFromCenterFloatG(k, x, y); - mDistanceCache[index] = normalizedSquaredDistance; + mDistanceCache_G[index] = normalizedSquaredDistance; if (normalizedSquaredDistance < NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD) { mNearKeysVector[i][k] = true; } @@ -686,7 +686,7 @@ float ProximityInfoState::getPointToKeyLength( const int keyId = mProximityInfo->getKeyIndexOf(codePoint); if (keyId != NOT_AN_INDEX) { const int index = inputIndex * mProximityInfo->getKeyCount() + keyId; - return min(mDistanceCache[index] * scale, mMaxPointToKeyLength); + return min(mDistanceCache_G[index] * scale, mMaxPointToKeyLength); } if (isSkippableCodePoint(codePoint)) { return 0.0f; @@ -695,7 +695,7 @@ float ProximityInfoState::getPointToKeyLength( return MAX_POINT_TO_KEY_LENGTH; } -float ProximityInfoState::getPointToKeyLength(const int inputIndex, const int codePoint) const { +float ProximityInfoState::getPointToKeyLength_G(const int inputIndex, const int codePoint) const { return getPointToKeyLength(inputIndex, codePoint, 1.0f); } @@ -706,7 +706,7 @@ float ProximityInfoState::getPointToKeyByIdLength( const int inputIndex, const int keyId, const float scale) const { if (keyId != NOT_AN_INDEX) { const int index = inputIndex * mProximityInfo->getKeyCount() + keyId; - return min(mDistanceCache[index] * scale, mMaxPointToKeyLength); + return min(mDistanceCache_G[index] * scale, mMaxPointToKeyLength); } // If the char is not a key on the keyboard then return the max length. return static_cast<float>(MAX_POINT_TO_KEY_LENGTH); |