diff options
author | 2012-01-25 18:11:26 +0900 | |
---|---|---|
committer | 2012-01-25 19:29:40 +0900 | |
commit | 0bfe359ee42af9c4487ce56acf42c74a2510980d (patch) | |
tree | a77fb4d1bf55d857612d69614286fd78c98e6e03 /native/src | |
parent | af4efd5a3ec32d7f1bf61978286f3a7602ce5609 (diff) | |
download | latinime-0bfe359ee42af9c4487ce56acf42c74a2510980d.tar.gz latinime-0bfe359ee42af9c4487ce56acf42c74a2510980d.tar.xz latinime-0bfe359ee42af9c4487ce56acf42c74a2510980d.zip |
Add a test for auto-correction.
Fix two related subtle bugs:
- Stop singling out fat-finger-only corrections for rejection
when touch coordinates are not available.
- Remove a racy check that would happen only in debug mode
Change-Id: Ic904f9b27c091ca6b369052c4e65a630bff81257
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/defines.h | 1 | ||||
-rw-r--r-- | native/src/proximity_info.cpp | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/native/src/defines.h b/native/src/defines.h index 119a7d779..096f1fbf6 100644 --- a/native/src/defines.h +++ b/native/src/defines.h @@ -169,6 +169,7 @@ static void prof_out(void) { #define NOT_VALID_WORD -99 #define NOT_A_CHARACTER -1 #define NOT_A_DISTANCE -1 +#define NOT_A_COORDINATE -1 #define EQUIVALENT_CHAR_WITHOUT_DISTANCE_INFO -2 #define PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO -3 #define NOT_A_INDEX -1 diff --git a/native/src/proximity_info.cpp b/native/src/proximity_info.cpp index b91957c77..e0e938099 100644 --- a/native/src/proximity_info.cpp +++ b/native/src/proximity_info.cpp @@ -165,6 +165,9 @@ float ProximityInfo::calculateNormalizedSquaredDistance( if (!hasSweetSpotData(keyIndex)) { return NOT_A_DISTANCE_FLOAT; } + if (NOT_A_COORDINATE == mInputXCoordinates[inputIndex]) { + return NOT_A_DISTANCE_FLOAT; + } const float squaredDistance = calculateSquaredDistanceFromSweetSpotCenter(keyIndex, inputIndex); const float squaredRadius = square(mSweetSpotRadii[keyIndex]); return squaredDistance / squaredRadius; |