Merge "Change InputMessage.motion.pointerSize to a uint32_t."

This commit is contained in:
Narayan Kamath 2014-05-16 12:06:10 +00:00 committed by Gerrit Code Review
commit c9fcaf3751
2 changed files with 11 additions and 11 deletions

View File

@ -86,7 +86,7 @@ struct InputMessage {
float yOffset; float yOffset;
float xPrecision; float xPrecision;
float yPrecision; float yPrecision;
size_t pointerCount; uint32_t pointerCount;
struct Pointer { struct Pointer {
PointerProperties properties; PointerProperties properties;
PointerCoords coords; PointerCoords coords;
@ -234,7 +234,7 @@ public:
float yPrecision, float yPrecision,
nsecs_t downTime, nsecs_t downTime,
nsecs_t eventTime, nsecs_t eventTime,
size_t pointerCount, uint32_t pointerCount,
const PointerProperties* pointerProperties, const PointerProperties* pointerProperties,
const PointerCoords* pointerCoords); const PointerCoords* pointerCoords);
@ -360,7 +360,7 @@ private:
void initializeFrom(const InputMessage* msg) { void initializeFrom(const InputMessage* msg) {
eventTime = msg->body.motion.eventTime; eventTime = msg->body.motion.eventTime;
idBits.clear(); idBits.clear();
for (size_t i = 0; i < msg->body.motion.pointerCount; i++) { for (uint32_t i = 0; i < msg->body.motion.pointerCount; i++) {
uint32_t id = msg->body.motion.pointers[i].properties.id; uint32_t id = msg->body.motion.pointers[i].properties.id;
idBits.markBit(id); idBits.markBit(id);
idToIndex[id] = i; idToIndex[id] = i;

View File

@ -292,7 +292,7 @@ status_t InputPublisher::publishMotionEvent(
float yPrecision, float yPrecision,
nsecs_t downTime, nsecs_t downTime,
nsecs_t eventTime, nsecs_t eventTime,
size_t pointerCount, uint32_t pointerCount,
const PointerProperties* pointerProperties, const PointerProperties* pointerProperties,
const PointerCoords* pointerCoords) { const PointerCoords* pointerCoords) {
#if DEBUG_TRANSPORT_ACTIONS #if DEBUG_TRANSPORT_ACTIONS
@ -334,7 +334,7 @@ status_t InputPublisher::publishMotionEvent(
msg.body.motion.downTime = downTime; msg.body.motion.downTime = downTime;
msg.body.motion.eventTime = eventTime; msg.body.motion.eventTime = eventTime;
msg.body.motion.pointerCount = pointerCount; msg.body.motion.pointerCount = pointerCount;
for (size_t i = 0; i < pointerCount; i++) { for (uint32_t i = 0; i < pointerCount; i++) {
msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]); msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]);
msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]); msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]);
} }
@ -654,7 +654,7 @@ void InputConsumer::updateTouchState(InputMessage* msg) {
} }
void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) { void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) {
for (size_t i = 0; i < msg->body.motion.pointerCount; i++) { for (uint32_t i = 0; i < msg->body.motion.pointerCount; i++) {
uint32_t id = msg->body.motion.pointers[i].properties.id; uint32_t id = msg->body.motion.pointers[i].properties.id;
if (state.lastResample.idBits.hasBit(id)) { if (state.lastResample.idBits.hasBit(id)) {
PointerCoords& msgCoords = msg->body.motion.pointers[i].coords; PointerCoords& msgCoords = msg->body.motion.pointers[i].coords;
@ -894,10 +894,10 @@ void InputConsumer::initializeKeyEvent(KeyEvent* event, const InputMessage* msg)
} }
void InputConsumer::initializeMotionEvent(MotionEvent* event, const InputMessage* msg) { void InputConsumer::initializeMotionEvent(MotionEvent* event, const InputMessage* msg) {
size_t pointerCount = msg->body.motion.pointerCount; uint32_t pointerCount = msg->body.motion.pointerCount;
PointerProperties pointerProperties[pointerCount]; PointerProperties pointerProperties[pointerCount];
PointerCoords pointerCoords[pointerCount]; PointerCoords pointerCoords[pointerCount];
for (size_t i = 0; i < pointerCount; i++) { for (uint32_t i = 0; i < pointerCount; i++) {
pointerProperties[i].copyFrom(msg->body.motion.pointers[i].properties); pointerProperties[i].copyFrom(msg->body.motion.pointers[i].properties);
pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords); pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords);
} }
@ -922,9 +922,9 @@ void InputConsumer::initializeMotionEvent(MotionEvent* event, const InputMessage
} }
void InputConsumer::addSample(MotionEvent* event, const InputMessage* msg) { void InputConsumer::addSample(MotionEvent* event, const InputMessage* msg) {
size_t pointerCount = msg->body.motion.pointerCount; uint32_t pointerCount = msg->body.motion.pointerCount;
PointerCoords pointerCoords[pointerCount]; PointerCoords pointerCoords[pointerCount];
for (size_t i = 0; i < pointerCount; i++) { for (uint32_t i = 0; i < pointerCount; i++) {
pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords); pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords);
} }
@ -934,7 +934,7 @@ void InputConsumer::addSample(MotionEvent* event, const InputMessage* msg) {
bool InputConsumer::canAddSample(const Batch& batch, const InputMessage *msg) { bool InputConsumer::canAddSample(const Batch& batch, const InputMessage *msg) {
const InputMessage& head = batch.samples.itemAt(0); const InputMessage& head = batch.samples.itemAt(0);
size_t pointerCount = msg->body.motion.pointerCount; uint32_t pointerCount = msg->body.motion.pointerCount;
if (head.body.motion.pointerCount != pointerCount if (head.body.motion.pointerCount != pointerCount
|| head.body.motion.action != msg->body.motion.action) { || head.body.motion.action != msg->body.motion.action) {
return false; return false;