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

Commit 3b753829 authored by Romain Guy's avatar Romain Guy
Browse files

Fix colored rects clipping and code cleanup

The drawColorRects() method was clipping individual rectangles
using the wrong parameters left, top, right and bottom instead
of l, r, t and b. It also checked for count == 0 after the loop
when it should have checked for vertexCount == 0. The quickReject
is now not part of the loop since it's a bit overkill to perform
so many matrix multiplications. What we really care about is the
final quickReject performed on the max bounds of the entire set
of rectangles.

This change also replaces all instances of mSnapshot->transform
by currentTransform() to make the code slightly more readable.

Change-Id: I6485280414499716852f7dbfba186774eb6763d4
parent e78b8003
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -454,6 +454,14 @@ void Matrix4::mapRect(Rect& r) const {
    }
}

void Matrix4::decomposeScale(float& sx, float& sy) const {
    float len;
    len = data[mat4::kScaleX] * data[mat4::kScaleX] + data[mat4::kSkewX] * data[mat4::kSkewX];
    sx = copysignf(sqrtf(len), data[mat4::kScaleX]);
    len = data[mat4::kScaleY] * data[mat4::kScaleY] + data[mat4::kSkewY] * data[mat4::kSkewY];
    sy = copysignf(sqrtf(len), data[mat4::kScaleY]);
}

void Matrix4::dump() const {
    ALOGD("Matrix4[simple=%d, type=0x%x", isSimple(), getType());
    ALOGD("  %f %f %f %f", data[kScaleX], data[kSkewX], data[8], data[kTranslateX]);
+16 −0
Original line number Diff line number Diff line
@@ -79,6 +79,20 @@ public:
        load(v);
    }

    float operator[](int index) const {
        return data[index];
    }

    float& operator[](int index) {
        mType = kTypeUnknown;
        return data[index];
    }

    Matrix4& operator=(const SkMatrix& v) {
        load(v);
        return *this;
    }

    void loadIdentity();

    void load(const float* v);
@@ -150,6 +164,8 @@ public:
    float getTranslateX();
    float getTranslateY();

    void decomposeScale(float& sx, float& sy) const;

    void dump() const;

    static const Matrix4& identity();
+91 −90

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -903,6 +903,10 @@ private:
        mDirtyClip = true;
    }

    inline mat4& currentTransform() const {
        return *mSnapshot->transform;
    }

    // Dimensions of the drawing surface
    int mWidth, mHeight;