Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80446086 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove PointerProperties::copyFrom" into main

parents 1efdbca6 73e6d378
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -493,12 +493,12 @@ struct PointerProperties {
        toolType = ToolType::UNKNOWN;
    }

    bool operator==(const PointerProperties& other) const;
    bool operator==(const PointerProperties& other) const = default;
    inline bool operator!=(const PointerProperties& other) const {
        return !(*this == other);
    }

    void copyFrom(const PointerProperties& other);
    PointerProperties& operator=(const PointerProperties&) = default;
};

/*
+0 −13
Original line number Diff line number Diff line
@@ -497,19 +497,6 @@ void PointerCoords::transform(const ui::Transform& transform) {
    }
}

// --- PointerProperties ---

bool PointerProperties::operator==(const PointerProperties& other) const {
    return id == other.id
            && toolType == other.toolType;
}

void PointerProperties::copyFrom(const PointerProperties& other) {
    id = other.id;
    toolType = other.toolType;
}


// --- MotionEvent ---

void MotionEvent::initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId,
+7 −7
Original line number Diff line number Diff line
@@ -692,8 +692,8 @@ status_t InputPublisher::publishMotionEvent(
    msg.body.motion.eventTime = eventTime;
    msg.body.motion.pointerCount = pointerCount;
    for (uint32_t i = 0; i < pointerCount; i++) {
        msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]);
        msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]);
        msg.body.motion.pointers[i].properties = pointerProperties[i];
        msg.body.motion.pointers[i].coords = pointerCoords[i];
    }

    return mChannel->sendMessage(&msg);
@@ -1270,13 +1270,13 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
            // We know here that the coordinates for the pointer haven't changed because we
            // would've cleared the resampled bit in rewriteMessage if they had. We can't modify
            // lastResample in place becasue the mapping from pointer ID to index may have changed.
            touchState.lastResample.pointers[i].copyFrom(oldLastResample.getPointerById(id));
            touchState.lastResample.pointers[i] = oldLastResample.getPointerById(id);
            continue;
        }

        PointerCoords& resampledCoords = touchState.lastResample.pointers[i];
        const PointerCoords& currentCoords = current->getPointerById(id);
        resampledCoords.copyFrom(currentCoords);
        resampledCoords = currentCoords;
        if (other->idBits.hasBit(id) && shouldResampleTool(event->getToolType(i))) {
            const PointerCoords& otherCoords = other->getPointerById(id);
            resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_X,
@@ -1454,8 +1454,8 @@ void InputConsumer::initializeMotionEvent(MotionEvent* event, const InputMessage
    PointerProperties pointerProperties[pointerCount];
    PointerCoords pointerCoords[pointerCount];
    for (uint32_t i = 0; i < pointerCount; i++) {
        pointerProperties[i].copyFrom(msg->body.motion.pointers[i].properties);
        pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords);
        pointerProperties[i] = msg->body.motion.pointers[i].properties;
        pointerCoords[i] = msg->body.motion.pointers[i].coords;
    }

    ui::Transform transform;
@@ -1484,7 +1484,7 @@ void InputConsumer::addSample(MotionEvent* event, const InputMessage* msg) {
    uint32_t pointerCount = msg->body.motion.pointerCount;
    PointerCoords pointerCoords[pointerCount];
    for (uint32_t i = 0; i < pointerCount; i++) {
        pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords);
        pointerCoords[i] = msg->body.motion.pointers[i].coords;
    }

    event->setMetaState(event->getMetaState() | msg->body.motion.metaState);
+2 −2
Original line number Diff line number Diff line
@@ -91,8 +91,8 @@ NotifyMotionArgs::NotifyMotionArgs(
        readTime(readTime),
        videoFrames(videoFrames) {
    for (uint32_t i = 0; i < pointerCount; i++) {
        this->pointerProperties.push_back(pointerProperties[i]);
        this->pointerCoords.push_back(pointerCoords[i]);
        this->pointerProperties.emplace_back(pointerProperties[i]);
        this->pointerCoords.emplace_back(pointerCoords[i]);
    }
}

+2 −2
Original line number Diff line number Diff line
@@ -235,8 +235,8 @@ MotionEntry::MotionEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32
        downTime(downTime),
        pointerCount(pointerCount) {
    for (uint32_t i = 0; i < pointerCount; i++) {
        this->pointerProperties[i].copyFrom(pointerProperties[i]);
        this->pointerCoords[i].copyFrom(pointerCoords[i]);
        this->pointerProperties[i] = pointerProperties[i];
        this->pointerCoords[i] = pointerCoords[i];
    }
}

Loading