Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
d56066b9
Commit
d56066b9
authored
1 year ago
by
Siarhei Vishniakou
Committed by
Android (Google) Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Pass MotionEvent by reference" into main
parents
a7a98560
1dcef1b4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/jni/android_view_VelocityTracker.cpp
+4
-4
4 additions, 4 deletions
core/jni/android_view_VelocityTracker.cpp
with
4 additions
and
4 deletions
core/jni/android_view_VelocityTracker.cpp
+
4
−
4
View file @
d56066b9
...
...
@@ -39,7 +39,7 @@ public:
explicit
VelocityTrackerState
(
const
VelocityTracker
::
Strategy
strategy
);
void
clear
();
void
addMovement
(
const
MotionEvent
*
event
);
void
addMovement
(
const
MotionEvent
&
event
);
// TODO(b/32830165): consider supporting an overload that supports computing velocity only for
// a subset of the supported axes.
void
computeCurrentVelocity
(
int32_t
units
,
float
maxVelocity
);
...
...
@@ -57,7 +57,7 @@ void VelocityTrackerState::clear() {
mVelocityTracker
.
clear
();
}
void
VelocityTrackerState
::
addMovement
(
const
MotionEvent
*
event
)
{
void
VelocityTrackerState
::
addMovement
(
const
MotionEvent
&
event
)
{
mVelocityTracker
.
addMovement
(
event
);
}
...
...
@@ -102,13 +102,13 @@ static void android_view_VelocityTracker_nativeClear(JNIEnv* env, jclass clazz,
static
void
android_view_VelocityTracker_nativeAddMovement
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
ptr
,
jobject
eventObj
)
{
const
MotionEvent
*
event
=
android_view_MotionEvent_getNativePtr
(
env
,
eventObj
);
if
(
!
event
)
{
if
(
event
==
nullptr
)
{
LOG
(
WARNING
)
<<
"nativeAddMovement failed because MotionEvent was finalized."
;
return
;
}
VelocityTrackerState
*
state
=
reinterpret_cast
<
VelocityTrackerState
*>
(
ptr
);
state
->
addMovement
(
event
);
state
->
addMovement
(
*
event
);
}
static
void
android_view_VelocityTracker_nativeComputeCurrentVelocity
(
JNIEnv
*
env
,
jclass
clazz
,
...
...
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