diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-27 13:13:22 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-27 13:13:22 +0000 |
commit | 631940c8c44e92939fc95d305b87be64eb9b886e (patch) | |
tree | 93d1d71e3f552410dce07c30edb0efad03e2c6b4 /include/utils/SkMatrix44.h | |
parent | 8ccf590b89cec1a5974b6f4b7b49ca67cc5036cf (diff) |
don't use bit-wise test for equality when using floats.
git-svn-id: http://skia.googlecode.com/svn/trunk@6557 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils/SkMatrix44.h')
-rw-r--r-- | include/utils/SkMatrix44.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h index e1de7c72a2..c082e964c5 100644 --- a/include/utils/SkMatrix44.h +++ b/include/utils/SkMatrix44.h @@ -105,20 +105,27 @@ public: return *this; } - bool operator==(const SkMatrix44& other) const { - return !memcmp(this, &other, sizeof(*this)); - } + bool operator==(const SkMatrix44& other) const; bool operator!=(const SkMatrix44& other) const { - return !!memcmp(this, &other, sizeof(*this)); + return !(other == *this); } SkMatrix44(const SkMatrix&); SkMatrix44& operator=(const SkMatrix& src); operator SkMatrix() const; - SkMScalar get(int row, int col) const; - void set(int row, int col, const SkMScalar& value); + SkMScalar get(int row, int col) const { + SkASSERT((unsigned)row <= 3); + SkASSERT((unsigned)col <= 3); + return fMat[col][row]; + } + void set(int row, int col, SkMScalar value) { + SkASSERT((unsigned)row <= 3); + SkASSERT((unsigned)col <= 3); + fMat[col][row] = value; + } + double getDouble(int row, int col) const { return SkMScalarToDouble(this->get(row, col)); } |