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
This commit is contained in:
parent
8ccf590b89
commit
631940c8c4
@ -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));
|
||||
}
|
||||
|
@ -22,16 +22,15 @@ SkMatrix44::SkMatrix44(const SkMatrix44& a, const SkMatrix44& b) {
|
||||
this->setConcat(a, b);
|
||||
}
|
||||
|
||||
SkMScalar SkMatrix44::get(int row, int col) const {
|
||||
SkASSERT(row <= 3 && row >= 0);
|
||||
SkASSERT(col <= 3 && col >= 0);
|
||||
return fMat[col][row];
|
||||
}
|
||||
|
||||
void SkMatrix44::set(int row, int col, const SkMScalar& value) {
|
||||
SkASSERT(row <= 3 && row >= 0);
|
||||
SkASSERT(col <= 3 && col >= 0);
|
||||
fMat[col][row] = value;
|
||||
bool SkMatrix44::operator==(const SkMatrix44& other) const {
|
||||
const SkMScalar* a = &fMat[0][0];
|
||||
const SkMScalar* b = &other.fMat[0][0];
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (a[i] != b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user