am 63dd5b4c: Merge "Simplify distance calculating method for gesture input." into jb-mr1-dev

* commit '63dd5b4c8f41d1fa79708bc7d5f312816786c8e0':
  Simplify distance calculating method for gesture input.
main
Ken Wakasa 2012-09-19 05:50:00 -07:00 committed by Android Git Automerger
commit edbd4a0660
2 changed files with 6 additions and 15 deletions

View File

@ -64,17 +64,8 @@ static inline float getAngleDiff(float a1, float a2) {
return diff;
}
// static float pointToLineSegSquaredDistanceFloat(
// float x, float y, float x1, float y1, float x2, float y2) {
// float A = x - x1;
// float B = y - y1;
// float C = x2 - x1;
// float D = y2 - y1;
// return fabsf(A * D - C * B) / sqrtf(C * C + D * D);
// }
static inline float pointToLineSegSquaredDistanceFloat(
float x, float y, float x1, float y1, float x2, float y2) {
float x, float y, float x1, float y1, float x2, float y2, bool extend) {
const float ray1x = x - x1;
const float ray1y = y - y1;
const float ray2x = x2 - x1;
@ -86,10 +77,10 @@ static inline float pointToLineSegSquaredDistanceFloat(
float projectionX;
float projectionY;
if (projectionLengthSqr < 0.0f) {
if (!extend && projectionLengthSqr < 0.0f) {
projectionX = x1;
projectionY = y1;
} else if (projectionLengthSqr > 1.0f) {
} else if (!extend && projectionLengthSqr > 1.0f) {
projectionX = x2;
projectionY = y2;
} else {

View File

@ -504,7 +504,7 @@ int32_t ProximityInfoState::getAllPossibleChars(
if (index >= mInputXs.size()) {
return filterSize;
}
int i = filterSize;
int newFilterSize = filterSize;
for (int j = 0; j < mProximityInfo->getKeyCount(); ++j) {
if (mNearKeysVector[index].test(j)) {
const int32_t keyCodePoint = mProximityInfo->getCodePointOf(j);
@ -517,11 +517,11 @@ int32_t ProximityInfoState::getAllPossibleChars(
}
}
if (insert) {
filter[i++] = keyCodePoint;
filter[newFilterSize++] = keyCodePoint;
}
}
}
return i;
return newFilterSize;
}
float ProximityInfoState::getAveragePointDuration() const {