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

Commit e68720ee authored by Andy McFadden's avatar Andy McFadden Committed by Android (Google) Code Review
Browse files

Merge "Minor fixes to android.graphics.Matrix"

parents 68389dee 73b81e75
Loading
Loading
Loading
Loading
+29 −13
Original line number Diff line number Diff line
@@ -270,10 +270,20 @@ public class Matrix {

    /** Returns true iff obj is a Matrix and its values equal our values.
    */
    @Override
    public boolean equals(Object obj) {
        return obj != null &&
               obj instanceof Matrix &&
               native_equals(native_instance, ((Matrix)obj).native_instance);
        //if (obj == this) return true;     -- NaN value would mean matrix != itself
        if (!(obj instanceof Matrix)) return false;
        return native_equals(native_instance, ((Matrix)obj).native_instance);
    }

    @Override
    public int hashCode() {
        // This should generate the hash code by performing some arithmetic operation on all
        // the matrix elements -- our equals() does an element-by-element comparison, and we
        // need to ensure that the hash code for two equal objects is the same.  We're not
        // really using this at the moment, so we take the easy way out.
        return 44;
    }

    /** Set the matrix to identity */
@@ -736,6 +746,7 @@ public class Matrix {
        native_setValues(native_instance, values);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(64);
        sb.append("Matrix{");
@@ -783,8 +794,13 @@ public class Matrix {

    }

    @Override
    protected void finalize() throws Throwable {
        try {
            finalizer(native_instance);
        } finally {
            super.finalize();
        }
    }

    /*package*/ final int ni() {