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

Commit 44634c8c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Convert mSampleEventTimes to std::vector"

parents a072152d 46a27747
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -722,7 +722,7 @@ public:
    inline const PointerProperties* getPointerProperties() const {
        return mPointerProperties.array();
    }
    inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); }
    inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.data(); }
    inline const PointerCoords* getSamplePointerCoords() const {
            return mSamplePointerCoords.array();
    }
@@ -747,7 +747,7 @@ protected:
    float mRawYCursorPosition;
    nsecs_t mDownTime;
    Vector<PointerProperties> mPointerProperties;
    Vector<nsecs_t> mSampleEventTimes;
    std::vector<nsecs_t> mSampleEventTimes;
    Vector<PointerCoords> mSamplePointerCoords;
};

+5 −5
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) {
        mSamplePointerCoords = other->mSamplePointerCoords;
    } else {
        mSampleEventTimes.clear();
        mSampleEventTimes.push(other->getEventTime());
        mSampleEventTimes.push_back(other->getEventTime());
        mSamplePointerCoords.clear();
        size_t pointerCount = other->getPointerCount();
        size_t historySize = other->getHistorySize();
@@ -388,7 +388,7 @@ void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) {
void MotionEvent::addSample(
        int64_t eventTime,
        const PointerCoords* pointerCoords) {
    mSampleEventTimes.push(eventTime);
    mSampleEventTimes.push_back(eventTime);
    mSamplePointerCoords.appendArray(pointerCoords, getPointerCount());
}

@@ -599,7 +599,7 @@ status_t MotionEvent::readFromParcel(Parcel* parcel) {
    mPointerProperties.clear();
    mPointerProperties.setCapacity(pointerCount);
    mSampleEventTimes.clear();
    mSampleEventTimes.setCapacity(sampleCount);
    mSampleEventTimes.reserve(sampleCount);
    mSamplePointerCoords.clear();
    mSamplePointerCoords.setCapacity(sampleCount * pointerCount);

@@ -612,7 +612,7 @@ status_t MotionEvent::readFromParcel(Parcel* parcel) {

    while (sampleCount > 0) {
        sampleCount--;
        mSampleEventTimes.push(parcel->readInt64());
        mSampleEventTimes.push_back(parcel->readInt64());
        for (size_t i = 0; i < pointerCount; i++) {
            mSamplePointerCoords.push();
            status_t status = mSamplePointerCoords.editTop().readFromParcel(parcel);
@@ -663,7 +663,7 @@ status_t MotionEvent::writeToParcel(Parcel* parcel) const {

    const PointerCoords* pc = mSamplePointerCoords.array();
    for (size_t h = 0; h < sampleCount; h++) {
        parcel->writeInt64(mSampleEventTimes.itemAt(h));
        parcel->writeInt64(mSampleEventTimes[h]);
        for (size_t i = 0; i < pointerCount; i++) {
            status_t status = (pc++)->writeToParcel(parcel);
            if (status) {