mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Calculate isContinuationPossible for typing"
This commit is contained in:
commit
7ead070db5
@ -376,6 +376,7 @@ static inline void prof_out(void) {
|
||||
#define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3
|
||||
|
||||
// TODO: Remove
|
||||
#define MAX_POINTER_COUNT 1
|
||||
#define MAX_POINTER_COUNT_FOR_G 2
|
||||
|
||||
// Size, in bytes, of the bloom filter index for bigrams
|
||||
|
@ -39,12 +39,8 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
|
||||
const ProximityInfo *proximityInfo, const int *const inputCodes, const int inputSize,
|
||||
const int *const xCoordinates, const int *const yCoordinates, const int *const times,
|
||||
const int *const pointerIds, const bool isGeometric) {
|
||||
if (isGeometric) {
|
||||
mIsContinuationPossible = checkAndReturnIsContinuationPossible(
|
||||
inputSize, xCoordinates, yCoordinates, times);
|
||||
} else {
|
||||
mIsContinuationPossible = false;
|
||||
}
|
||||
mIsContinuationPossible = checkAndReturnIsContinuationPossible(
|
||||
inputSize, xCoordinates, yCoordinates, times, isGeometric);
|
||||
|
||||
mProximityInfo = proximityInfo;
|
||||
mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
|
||||
@ -466,13 +462,27 @@ float ProximityInfoState::calculateBeelineSpeedRate(
|
||||
}
|
||||
|
||||
bool ProximityInfoState::checkAndReturnIsContinuationPossible(const int inputSize,
|
||||
const int *const xCoordinates, const int *const yCoordinates, const int *const times) {
|
||||
for (int i = 0; i < mSampledInputSize; ++i) {
|
||||
const int index = mInputIndice[i];
|
||||
if (index > inputSize || xCoordinates[index] != mSampledInputXs[i] ||
|
||||
yCoordinates[index] != mSampledInputYs[i] || times[index] != mTimes[i]) {
|
||||
const int *const xCoordinates, const int *const yCoordinates, const int *const times,
|
||||
const bool isGeometric) const {
|
||||
if (isGeometric) {
|
||||
for (int i = 0; i < mSampledInputSize; ++i) {
|
||||
const int index = mInputIndice[i];
|
||||
if (index > inputSize || xCoordinates[index] != mSampledInputXs[i] ||
|
||||
yCoordinates[index] != mSampledInputYs[i] || times[index] != mTimes[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inputSize < mSampledInputSize) {
|
||||
// Assuming the cache is invalid if the previous input size is larger than the new one.
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < mSampledInputSize && i < MAX_WORD_LENGTH_INTERNAL; ++i) {
|
||||
if (xCoordinates[i] != mSampledInputXs[i]
|
||||
|| yCoordinates[i] != mSampledInputYs[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ class ProximityInfoState {
|
||||
const NearKeysDistanceMap *const prevNearKeysDistances,
|
||||
const NearKeysDistanceMap *const prevPrevNearKeysDistances) const;
|
||||
bool checkAndReturnIsContinuationPossible(const int inputSize, const int *const xCoordinates,
|
||||
const int *const yCoordinates, const int *const times);
|
||||
const int *const yCoordinates, const int *const times, const bool isGeometric) const;
|
||||
void popInputData();
|
||||
void updateAlignPointProbabilities(const int start);
|
||||
bool suppressCharProbabilities(const int index1, const int index2);
|
||||
|
Loading…
Reference in New Issue
Block a user