am ed4d28dd: Add method to apply offset to PointerCoords. (DO NOT MERGE)

* commit 'ed4d28dd70448b13eb74a3166ec8d1c1a530e2d4':
  Add method to apply offset to PointerCoords.  (DO NOT MERGE)
This commit is contained in:
Jeff Brown 2014-02-12 00:26:19 +00:00 committed by Android Git Automerger
commit eac45b8a53
2 changed files with 6 additions and 0 deletions

View File

@ -184,6 +184,7 @@ struct PointerCoords {
status_t setAxisValue(int32_t axis, float value);
void scale(float scale);
void applyOffset(float xOffset, float yOffset);
inline float getX() const {
return getAxisValue(AMOTION_EVENT_AXIS_X);

View File

@ -213,6 +213,11 @@ void PointerCoords::scale(float scaleFactor) {
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor);
}
void PointerCoords::applyOffset(float xOffset, float yOffset) {
setAxisValue(AMOTION_EVENT_AXIS_X, getX() + xOffset);
setAxisValue(AMOTION_EVENT_AXIS_Y, getY() + yOffset);
}
#ifdef HAVE_ANDROID_OS
status_t PointerCoords::readFromParcel(Parcel* parcel) {
bits = parcel->readInt64();