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
6e2ba9b0
You need to sign in or sign up before continuing.
Commit
6e2ba9b0
authored
12 years ago
by
Ken Wakasa
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary maxProximityCharsSize
Change-Id: I8013004c1db2a4133795a0e41edea1a41b770cfd
parent
a47c699f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
native/jni/src/proximity_info.cpp
+2
-2
2 additions, 2 deletions
native/jni/src/proximity_info.cpp
native/jni/src/proximity_info.h
+2
-3
2 additions, 3 deletions
native/jni/src/proximity_info.h
native/jni/src/proximity_info_utils.h
+17
-22
17 additions, 22 deletions
native/jni/src/proximity_info_utils.h
with
21 additions
and
27 deletions
native/jni/src/proximity_info.cpp
+
2
−
2
View file @
6e2ba9b0
...
...
@@ -110,8 +110,8 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
return
false
;
}
const
int
startIndex
=
ProximityInfoUtils
::
getStartIndexFromCoordinates
(
MAX_PROXIMITY_CHARS_SIZE
,
x
,
y
,
CELL_HEIGHT
,
CELL_WIDTH
,
GRID_WIDTH
);
const
int
startIndex
=
ProximityInfoUtils
::
getStartIndexFromCoordinates
(
x
,
y
,
CELL_HEIGHT
,
CELL_WIDTH
,
GRID_WIDTH
);
if
(
DEBUG_PROXIMITY_INFO
)
{
AKLOGI
(
"hasSpaceProximity: index %d, %d, %d"
,
startIndex
,
x
,
y
);
}
...
...
This diff is collapsed.
Click to expand it.
native/jni/src/proximity_info.h
+
2
−
3
View file @
6e2ba9b0
...
...
@@ -73,9 +73,8 @@ class ProximityInfo {
const
int
*
const
inputYCoordinates
,
const
int
inputSize
,
int
*
allInputCodes
)
const
{
ProximityInfoUtils
::
initializeProximities
(
inputCodes
,
inputXCoordinates
,
inputYCoordinates
,
inputSize
,
mKeyXCoordinates
,
mKeyYCoordinates
,
mKeyWidths
,
mKeyHeights
,
mProximityCharsArray
,
MAX_PROXIMITY_CHARS_SIZE
,
CELL_HEIGHT
,
CELL_WIDTH
,
GRID_WIDTH
,
MOST_COMMON_KEY_WIDTH
,
KEY_COUNT
,
mLocaleStr
,
&
mCodeToKeyMap
,
allInputCodes
);
mProximityCharsArray
,
CELL_HEIGHT
,
CELL_WIDTH
,
GRID_WIDTH
,
MOST_COMMON_KEY_WIDTH
,
KEY_COUNT
,
mLocaleStr
,
&
mCodeToKeyMap
,
allInputCodes
);
}
int
getKeyIndexOf
(
const
int
c
)
const
{
...
...
This diff is collapsed.
Click to expand it.
native/jni/src/proximity_info_utils.h
+
17
−
22
View file @
6e2ba9b0
...
...
@@ -49,9 +49,9 @@ class ProximityInfoUtils {
const
int
*
const
inputXCoordinates
,
const
int
*
const
inputYCoordinates
,
const
int
inputSize
,
const
int
*
const
keyXCoordinates
,
const
int
*
const
keyYCoordinates
,
const
int
*
const
keyWidths
,
const
int
*
keyHeights
,
const
int
*
const
proximityCharsArray
,
const
int
maxProximityCharsSize
,
const
int
cellHeight
,
const
int
cell
Width
,
const
int
gridWidth
,
const
int
mostCommonKeyWidth
,
const
int
keyCount
,
const
char
*
const
localeStr
,
const
int
*
const
proximityCharsArray
,
const
int
cellHeight
,
const
int
cellWidth
,
const
int
gridWidth
,
const
int
mostCommonKey
Width
,
const
int
keyCount
,
const
char
*
const
localeStr
,
const
hash_map_compat
<
int
,
int
>
*
const
codeToKeyMap
,
int
*
inputProximities
)
{
// Initialize
// - mInputCodes
...
...
@@ -63,9 +63,8 @@ class ProximityInfoUtils {
const
int
y
=
inputYCoordinates
[
i
];
int
*
proximities
=
&
inputProximities
[
i
*
MAX_PROXIMITY_CHARS_SIZE
];
calculateProximities
(
keyXCoordinates
,
keyYCoordinates
,
keyWidths
,
keyHeights
,
proximityCharsArray
,
maxProximityCharsSize
,
cellHeight
,
cellWidth
,
gridWidth
,
mostCommonKeyWidth
,
keyCount
,
x
,
y
,
primaryKey
,
localeStr
,
codeToKeyMap
,
proximities
);
proximityCharsArray
,
cellHeight
,
cellWidth
,
gridWidth
,
mostCommonKeyWidth
,
keyCount
,
x
,
y
,
primaryKey
,
localeStr
,
codeToKeyMap
,
proximities
);
}
if
(
DEBUG_PROXIMITY_CHARS
)
{
...
...
@@ -81,10 +80,9 @@ class ProximityInfoUtils {
}
}
static
AK_FORCE_INLINE
int
getStartIndexFromCoordinates
(
const
int
maxProximityCharsSize
,
const
int
x
,
const
int
y
,
const
int
cellHeight
,
const
int
cellWidth
,
const
int
gridWidth
)
{
return
((
y
/
cellHeight
)
*
gridWidth
+
(
x
/
cellWidth
))
*
maxProximityCharsSize
;
static
AK_FORCE_INLINE
int
getStartIndexFromCoordinates
(
const
int
x
,
const
int
y
,
const
int
cellHeight
,
const
int
cellWidth
,
const
int
gridWidth
)
{
return
((
y
/
cellHeight
)
*
gridWidth
+
(
x
/
cellWidth
))
*
MAX_PROXIMITY_CHARS_SIZE
;
}
static
inline
float
getSquaredDistanceFloat
(
const
float
x1
,
const
float
y1
,
const
float
x2
,
...
...
@@ -153,21 +151,18 @@ class ProximityInfoUtils {
return
left
<
right
&&
top
<
bottom
&&
x
>=
left
&&
x
<
right
&&
y
>=
top
&&
y
<
bottom
;
}
static
void
calculateProximities
(
const
int
*
const
keyXCoordinates
,
const
int
*
const
keyYCoordinates
,
const
int
*
const
keyWidths
,
const
int
*
keyHeights
,
const
int
*
const
proximityCharsArray
,
const
int
maxProximityCharsSize
,
const
int
cellHeight
,
const
int
cellWidth
,
static
void
calculateProximities
(
const
int
*
const
keyXCoordinates
,
const
int
*
const
keyYCoordinates
,
const
int
*
const
keyWidths
,
const
int
*
keyHeights
,
const
int
*
const
proximityCharsArray
,
const
int
cellHeight
,
const
int
cellWidth
,
const
int
gridWidth
,
const
int
mostCommonKeyWidth
,
const
int
keyCount
,
const
int
x
,
const
int
y
,
const
int
primaryKey
,
const
char
*
const
localeStr
,
const
hash_map_compat
<
int
,
int
>
*
const
codeToKeyMap
,
int
*
proximities
)
{
const
int
mostCommonKeyWidthSquare
=
mostCommonKeyWidth
*
mostCommonKeyWidth
;
int
insertPos
=
0
;
proximities
[
insertPos
++
]
=
primaryKey
;
const
int
startIndex
=
getStartIndexFromCoordinates
(
maxProximityCharsSize
,
x
,
y
,
cellHeight
,
cellWidth
,
gridWidth
);
const
int
startIndex
=
getStartIndexFromCoordinates
(
x
,
y
,
cellHeight
,
cellWidth
,
gridWidth
);
if
(
startIndex
>=
0
)
{
for
(
int
i
=
0
;
i
<
maxProximityCharsSize
;
++
i
)
{
for
(
int
i
=
0
;
i
<
MAX_PROXIMITY_CHARS_SIZE
;
++
i
)
{
const
int
c
=
proximityCharsArray
[
startIndex
+
i
];
if
(
c
<
KEYCODE_SPACE
||
c
==
primaryKey
)
{
continue
;
...
...
@@ -179,7 +174,7 @@ class ProximityInfoUtils {
keyWidths
,
keyHeights
,
keyIndex
,
x
,
y
);
if
(
onKey
||
distance
<
mostCommonKeyWidthSquare
)
{
proximities
[
insertPos
++
]
=
c
;
if
(
insertPos
>=
maxProximityCharsSize
)
{
if
(
insertPos
>=
MAX_PROXIMITY_CHARS_SIZE
)
{
if
(
DEBUG_DICT
)
{
ASSERT
(
false
);
}
...
...
@@ -191,7 +186,7 @@ class ProximityInfoUtils {
AdditionalProximityChars
::
getAdditionalCharsSize
(
localeStr
,
primaryKey
);
if
(
additionalProximitySize
>
0
)
{
proximities
[
insertPos
++
]
=
ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE
;
if
(
insertPos
>=
maxProximityCharsSize
)
{
if
(
insertPos
>=
MAX_PROXIMITY_CHARS_SIZE
)
{
if
(
DEBUG_DICT
)
{
ASSERT
(
false
);
}
...
...
@@ -212,7 +207,7 @@ class ProximityInfoUtils {
continue
;
}
proximities
[
insertPos
++
]
=
ac
;
if
(
insertPos
>=
maxProximityCharsSize
)
{
if
(
insertPos
>=
MAX_PROXIMITY_CHARS_SIZE
)
{
if
(
DEBUG_DICT
)
{
ASSERT
(
false
);
}
...
...
@@ -222,7 +217,7 @@ class ProximityInfoUtils {
}
}
// Add a delimiter for the proximity characters
for
(
int
i
=
insertPos
;
i
<
maxProximityCharsSize
;
++
i
)
{
for
(
int
i
=
insertPos
;
i
<
MAX_PROXIMITY_CHARS_SIZE
;
++
i
)
{
proximities
[
i
]
=
NOT_A_CODE_POINT
;
}
}
...
...
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