Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f31553bc authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Fix touch coordinate calibration"

parents ddafcf82 a1d84bcf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
}

float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
        const int keyId, const int x, const int y) const {
        const int keyId, const int x, const int y, const float verticalScale) const {
    const bool correctTouchPosition = hasTouchPositionCorrectionData();
    const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId)
            : getKeyCenterXOfKeyIdG(keyId));
@@ -138,7 +138,7 @@ float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
    if (correctTouchPosition) {
        const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId));
        const float gapY = sweetSpotCenterY - visualKeyCenterY;
        centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G;
        centerY = visualKeyCenterY + gapY * verticalScale;
    } else {
        centerY = visualKeyCenterY;
    }
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ class ProximityInfo {
    bool hasSpaceProximity(const int x, const int y) const;
    int getNormalizedSquaredDistance(const int inputIndex, const int proximityIndex) const;
    float getNormalizedSquaredDistanceFromCenterFloatG(
            const int keyId, const int x, const int y) const;
            const int keyId, const int x, const int y,
            const float verticalScale) const;
    bool sameAsTyped(const unsigned short *word, int length) const;
    int getCodePointOf(const int keyIndex) const;
    bool hasSweetSpotData(const int keyIndex) const {
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
namespace latinime {
const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f;
const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE = 1.0f;
const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 0.5f;

/* Per method constants */
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ class ProximityInfoParams {
 public:
    static const float NOT_A_DISTANCE_FLOAT;
    static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;
    static const float VERTICAL_SWEET_SPOT_SCALE;
    static const float VERTICAL_SWEET_SPOT_SCALE_G;

    // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
+11 −5
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@

namespace latinime {

// TODO: Remove the dependency of "isGeometric"
void ProximityInfoState::initInputParams(const int pointerId, const float maxPointToKeyLength,
        const ProximityInfo *proximityInfo, const int *const inputCodes, const int inputSize,
        const int *const xCoordinates, const int *const yCoordinates, const int *const times,
@@ -94,12 +95,17 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
                pushTouchPointStartIndex, lastSavedInputSize);
    }

    // TODO: Remove the dependency of "isGeometric"
    const float verticalSweetSpotScale = isGeometric
            ? ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G
            : ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE;

    if (xCoordinates && yCoordinates) {
        mSampledInputSize = ProximityInfoStateUtils::updateTouchPoints(mProximityInfo,
                mMaxPointToKeyLength, mInputProximities, xCoordinates, yCoordinates, times,
                pointerIds, inputSize, isGeometric, pointerId, pushTouchPointStartIndex,
                &mSampledInputXs, &mSampledInputYs, &mSampledTimes, &mSampledLengthCache,
                &mSampledInputIndice);
                pointerIds, verticalSweetSpotScale, inputSize, isGeometric, pointerId,
                pushTouchPointStartIndex, &mSampledInputXs, &mSampledInputYs, &mSampledTimes,
                &mSampledLengthCache, &mSampledInputIndice);
    }

    if (mSampledInputSize > 0 && isGeometric) {
@@ -115,8 +121,8 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi

    if (mSampledInputSize > 0) {
        ProximityInfoStateUtils::initGeometricDistanceInfos(mProximityInfo, mSampledInputSize,
                lastSavedInputSize, &mSampledInputXs, &mSampledInputYs, &mSampledNearKeySets,
                &mSampledDistanceCache_G);
                lastSavedInputSize, verticalSweetSpotScale, &mSampledInputXs, &mSampledInputYs,
                &mSampledNearKeySets, &mSampledDistanceCache_G);
        if (isGeometric) {
            // updates probabilities of skipping or mapping each key for all points.
            ProximityInfoStateUtils::updateAlignPointProbabilities(
Loading