Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
37b153e2
Commit
37b153e2
authored
12 years ago
by
Satoshi Kataoka
Browse files
Options
Downloads
Patches
Plain Diff
Step 40-A Cleanup touch path
Change-Id: Id22c5ae6afbf040227dc47153b0849bbe38ff66f
parent
1451a0fb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
native/jni/src/proximity_info_state.cpp
+9
-7
9 additions, 7 deletions
native/jni/src/proximity_info_state.cpp
native/jni/src/proximity_info_state.h
+17
-1
17 additions, 1 deletion
native/jni/src/proximity_info_state.h
with
26 additions
and
8 deletions
native/jni/src/proximity_info_state.cpp
+
9
−
7
View file @
37b153e2
...
@@ -84,12 +84,13 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
...
@@ -84,12 +84,13 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
// Assuming pointerId == 0 if pointerIds is null.
// Assuming pointerId == 0 if pointerIds is null.
const
int
pid
=
pointerIds
?
pointerIds
[
i
]
:
0
;
const
int
pid
=
pointerIds
?
pointerIds
[
i
]
:
0
;
if
(
pointerId
==
pid
)
{
if
(
pointerId
==
pid
)
{
++
mInputSize
;
const
int
c
=
isGeometric
?
NOT_A_COORDINATE
:
getPrimaryCharAt
(
i
);
const
int
c
=
isGeometric
?
NOT_A_COORDINATE
:
getPrimaryCharAt
(
i
);
const
int
x
=
proximityOnly
?
NOT_A_COORDINATE
:
xCoordinates
[
i
];
const
int
x
=
proximityOnly
?
NOT_A_COORDINATE
:
xCoordinates
[
i
];
const
int
y
=
proximityOnly
?
NOT_A_COORDINATE
:
yCoordinates
[
i
];
const
int
y
=
proximityOnly
?
NOT_A_COORDINATE
:
yCoordinates
[
i
];
const
int
time
=
times
?
times
[
i
]
:
-
1
;
const
int
time
=
times
?
times
[
i
]
:
-
1
;
pushTouchPoint
(
c
,
x
,
y
,
time
,
isGeometric
);
if
(
pushTouchPoint
(
c
,
x
,
y
,
time
,
isGeometric
))
{
++
mInputSize
;
}
}
}
}
}
}
}
...
@@ -152,7 +153,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
...
@@ -152,7 +153,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
}
}
}
}
void
ProximityInfoState
::
pushTouchPoint
(
const
int
nodeChar
,
int
x
,
int
y
,
bool
ProximityInfoState
::
pushTouchPoint
(
const
int
nodeChar
,
int
x
,
int
y
,
const
int
time
,
const
bool
sample
)
{
const
int
time
,
const
bool
sample
)
{
const
uint32_t
size
=
mInputXs
.
size
();
const
uint32_t
size
=
mInputXs
.
size
();
// TODO: Should have a const variable for 10
// TODO: Should have a const variable for 10
...
@@ -160,7 +161,7 @@ void ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y,
...
@@ -160,7 +161,7 @@ void ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y,
if
(
size
>
0
)
{
if
(
size
>
0
)
{
const
int
dist
=
getDistanceInt
(
x
,
y
,
mInputXs
[
size
-
1
],
mInputYs
[
size
-
1
]);
const
int
dist
=
getDistanceInt
(
x
,
y
,
mInputXs
[
size
-
1
],
mInputYs
[
size
-
1
]);
if
(
sample
&&
dist
<
sampleRate
)
{
if
(
sample
&&
dist
<
sampleRate
)
{
return
;
return
false
;
}
}
mLengthCache
.
push_back
(
mLengthCache
[
size
-
1
]
+
dist
);
mLengthCache
.
push_back
(
mLengthCache
[
size
-
1
]
+
dist
);
}
else
{
}
else
{
...
@@ -176,6 +177,7 @@ void ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y,
...
@@ -176,6 +177,7 @@ void ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y,
mInputXs
.
push_back
(
x
);
mInputXs
.
push_back
(
x
);
mInputYs
.
push_back
(
y
);
mInputYs
.
push_back
(
y
);
mTimes
.
push_back
(
time
);
mTimes
.
push_back
(
time
);
return
true
;
}
}
float
ProximityInfoState
::
calculateNormalizedSquaredDistance
(
float
ProximityInfoState
::
calculateNormalizedSquaredDistance
(
...
@@ -196,10 +198,10 @@ float ProximityInfoState::calculateNormalizedSquaredDistance(
...
@@ -196,10 +198,10 @@ float ProximityInfoState::calculateNormalizedSquaredDistance(
}
}
int
ProximityInfoState
::
getDuration
(
const
int
index
)
const
{
int
ProximityInfoState
::
getDuration
(
const
int
index
)
const
{
if
(
m
Times
.
size
()
==
0
||
index
<=
0
||
index
>=
static_cast
<
int
>
(
mInputSize
)
-
1
)
{
if
(
m
InputSize
>
0
&&
index
>
0
&&
index
<
static_cast
<
int
>
(
mInputSize
)
-
1
)
{
return
0
;
return
mTimes
[
index
+
1
]
-
mTimes
[
index
-
1
]
;
}
}
return
mTimes
[
index
+
1
]
-
mTimes
[
index
-
1
]
;
return
0
;
}
}
float
ProximityInfoState
::
getPointToKeyLength
(
int
inputIndex
,
int
charCode
,
float
scale
)
{
float
ProximityInfoState
::
getPointToKeyLength
(
int
inputIndex
,
int
charCode
,
float
scale
)
{
...
...
This diff is collapsed.
Click to expand it.
native/jni/src/proximity_info_state.h
+
17
−
1
View file @
37b153e2
...
@@ -192,6 +192,22 @@ class ProximityInfoState {
...
@@ -192,6 +192,22 @@ class ProximityInfoState {
return
mInputSize
>
0
;
return
mInputSize
>
0
;
}
}
uint32_t
size
()
const
{
return
mInputSize
;
}
int
getInputX
(
int
index
)
const
{
return
mInputXs
[
index
];
}
int
getInputY
(
int
index
)
const
{
return
mInputYs
[
index
];
}
int
getLengthCache
(
int
index
)
const
{
return
mLengthCache
[
index
];
}
float
getPointToKeyLength
(
int
inputIndex
,
int
charCode
,
float
scale
);
float
getPointToKeyLength
(
int
inputIndex
,
int
charCode
,
float
scale
);
int
getKeyKeyDistance
(
int
key0
,
int
key1
);
int
getKeyKeyDistance
(
int
key0
,
int
key1
);
...
@@ -208,7 +224,7 @@ class ProximityInfoState {
...
@@ -208,7 +224,7 @@ class ProximityInfoState {
float
calculateSquaredDistanceFromSweetSpotCenter
(
float
calculateSquaredDistanceFromSweetSpotCenter
(
const
int
keyIndex
,
const
int
inputIndex
)
const
;
const
int
keyIndex
,
const
int
inputIndex
)
const
;
void
pushTouchPoint
(
const
int
nodeChar
,
int
x
,
int
y
,
const
int
time
,
const
bool
sample
);
bool
pushTouchPoint
(
const
int
nodeChar
,
int
x
,
int
y
,
const
int
time
,
const
bool
sample
);
/////////////////////////////////////////
/////////////////////////////////////////
// Defined here //
// Defined here //
/////////////////////////////////////////
/////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment