Merge "resolved conflicts for merge of 05be6d6f to master"
This commit is contained in:
commit
c3d5cb6980
@ -216,6 +216,8 @@ struct PointerCoords {
|
|||||||
status_t setAxisValue(int32_t axis, float value);
|
status_t setAxisValue(int32_t axis, float value);
|
||||||
float* editAxisValue(int32_t axis);
|
float* editAxisValue(int32_t axis);
|
||||||
|
|
||||||
|
void scale(float scale);
|
||||||
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
status_t readFromParcel(Parcel* parcel);
|
status_t readFromParcel(Parcel* parcel);
|
||||||
status_t writeToParcel(Parcel* parcel) const;
|
status_t writeToParcel(Parcel* parcel) const;
|
||||||
|
@ -302,6 +302,24 @@ float* PointerCoords::editAxisValue(int32_t axis) {
|
|||||||
return &values[index];
|
return &values[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void scaleAxisValue(PointerCoords& c, int axis, float scaleFactor) {
|
||||||
|
float* value = c.editAxisValue(axis);
|
||||||
|
if (value) {
|
||||||
|
*value *= scaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PointerCoords::scale(float scaleFactor) {
|
||||||
|
// No need to scale pressure or size since they are normalized.
|
||||||
|
// No need to scale orientation since it is meaningless to do so.
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_X, scaleFactor);
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_Y, scaleFactor);
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOUCH_MAJOR, scaleFactor);
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOUCH_MINOR, scaleFactor);
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MAJOR, scaleFactor);
|
||||||
|
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
status_t PointerCoords::readFromParcel(Parcel* parcel) {
|
status_t PointerCoords::readFromParcel(Parcel* parcel) {
|
||||||
bits = parcel->readInt64();
|
bits = parcel->readInt64();
|
||||||
@ -436,11 +454,9 @@ float MotionEvent::getAxisValue(int32_t axis, size_t pointerIndex) const {
|
|||||||
float value = getRawPointerCoords(pointerIndex)->getAxisValue(axis);
|
float value = getRawPointerCoords(pointerIndex)->getAxisValue(axis);
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case AMOTION_EVENT_AXIS_X:
|
case AMOTION_EVENT_AXIS_X:
|
||||||
value += mXOffset;
|
return value + mXOffset;
|
||||||
break;
|
|
||||||
case AMOTION_EVENT_AXIS_Y:
|
case AMOTION_EVENT_AXIS_Y:
|
||||||
value += mYOffset;
|
return value + mYOffset;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -460,11 +476,9 @@ float MotionEvent::getHistoricalAxisValue(int32_t axis, size_t pointerIndex,
|
|||||||
float value = getHistoricalRawPointerCoords(pointerIndex, historicalIndex)->getAxisValue(axis);
|
float value = getHistoricalRawPointerCoords(pointerIndex, historicalIndex)->getAxisValue(axis);
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case AMOTION_EVENT_AXIS_X:
|
case AMOTION_EVENT_AXIS_X:
|
||||||
value += mXOffset;
|
return value + mXOffset;
|
||||||
break;
|
|
||||||
case AMOTION_EVENT_AXIS_Y:
|
case AMOTION_EVENT_AXIS_Y:
|
||||||
value += mYOffset;
|
return value + mYOffset;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -484,13 +498,6 @@ void MotionEvent::offsetLocation(float xOffset, float yOffset) {
|
|||||||
mYOffset += yOffset;
|
mYOffset += yOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void scaleAxisValue(PointerCoords& c, int axis, float scaleFactor) {
|
|
||||||
float* value = c.editAxisValue(axis);
|
|
||||||
if (value) {
|
|
||||||
*value *= scaleFactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MotionEvent::scale(float scaleFactor) {
|
void MotionEvent::scale(float scaleFactor) {
|
||||||
mXOffset *= scaleFactor;
|
mXOffset *= scaleFactor;
|
||||||
mYOffset *= scaleFactor;
|
mYOffset *= scaleFactor;
|
||||||
@ -499,15 +506,7 @@ void MotionEvent::scale(float scaleFactor) {
|
|||||||
|
|
||||||
size_t numSamples = mSamplePointerCoords.size();
|
size_t numSamples = mSamplePointerCoords.size();
|
||||||
for (size_t i = 0; i < numSamples; i++) {
|
for (size_t i = 0; i < numSamples; i++) {
|
||||||
PointerCoords& c = mSamplePointerCoords.editItemAt(i);
|
mSamplePointerCoords.editItemAt(i).scale(scaleFactor);
|
||||||
// No need to scale pressure or size since they are normalized.
|
|
||||||
// No need to scale orientation since it is meaningless to do so.
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_X, scaleFactor);
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_Y, scaleFactor);
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_TOUCH_MAJOR, scaleFactor);
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_TOUCH_MINOR, scaleFactor);
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_TOOL_MAJOR, scaleFactor);
|
|
||||||
scaleAxisValue(c, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user