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

Commit 775ffa78 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Fix crashes in setMatrix() and concat()"

parents 4a83804d 4e7b772b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -621,7 +621,7 @@ class GLES20Canvas extends HardwareCanvas {

    @Override
    public void concat(Matrix matrix) {
        nConcatMatrix(mRenderer, matrix.native_instance);
        if (matrix != null) nConcatMatrix(mRenderer, matrix.native_instance);
    }
    
    private static native void nConcatMatrix(int renderer, int matrix);
+3 −2
Original line number Diff line number Diff line
@@ -513,12 +513,13 @@ public class Canvas {
    public native void skew(float sx, float sy);

    /**
     * Preconcat the current matrix with the specified matrix.
     * Preconcat the current matrix with the specified matrix. If the specified
     * matrix is null, this method does nothing.
     *
     * @param matrix The matrix to preconcatenate with the current matrix
     */
    public void concat(Matrix matrix) {
        native_concat(mNativeCanvas, matrix.native_instance);
        if (matrix != null) native_concat(mNativeCanvas, matrix.native_instance);
    }
    
    /**
+5 −1
Original line number Diff line number Diff line
@@ -468,7 +468,11 @@ public:
    }

    virtual void output(int level, uint32_t logFlags) const {
        if (mMatrix) {
            OP_LOG("SetMatrix " MATRIX_STRING, MATRIX_ARGS(mMatrix));
        } else {
            OP_LOGS("SetMatrix (reset)");
        }
    }

    virtual const char* name() { return "SetMatrix"; }
+8 −5
Original line number Diff line number Diff line
@@ -269,12 +269,15 @@ private:
    }

    inline SkMatrix* refMatrix(SkMatrix* matrix) {
        // Copying the matrix is cheap and prevents against the user changing the original
        // matrix before the operation that uses it
        if (matrix) {
            // Copying the matrix is cheap and prevents against the user changing
            // the original matrix before the operation that uses it
            SkMatrix* copy = new SkMatrix(*matrix);
            mMatrices.add(copy);
            return copy;
        }
        return matrix;
    }

    inline Layer* refLayer(Layer* layer) {
        mLayers.add(layer);