Commit a2124f992c7a3c2695b93cf7fe9298c3a862ffc9
1 parent
552303a9
Add QPDFMatrix::operator==
Showing
3 changed files
with
23 additions
and
0 deletions
ChangeLog
include/qpdf/QPDFMatrix.hh
| ... | ... | @@ -90,6 +90,16 @@ class QPDFMatrix |
| 90 | 90 | QPDFObjectHandle::Rectangle transformRectangle( |
| 91 | 91 | QPDFObjectHandle::Rectangle r); |
| 92 | 92 | |
| 93 | + // operator== tests for exact equality, not considering deltas for | |
| 94 | + // floating point. | |
| 95 | + QPDF_DLL | |
| 96 | + bool operator==(QPDFMatrix const& rhs) const; | |
| 97 | + QPDF_DLL | |
| 98 | + bool operator!=(QPDFMatrix const& rhs) const | |
| 99 | + { | |
| 100 | + return ! operator==(rhs); | |
| 101 | + } | |
| 102 | + | |
| 93 | 103 | double a; |
| 94 | 104 | double b; |
| 95 | 105 | double c; | ... | ... |
libqpdf/QPDFMatrix.cc
| ... | ... | @@ -142,3 +142,14 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const |
| 142 | 142 | *std::max_element(tx.begin(), tx.end()), |
| 143 | 143 | *std::max_element(ty.begin(), ty.end())); |
| 144 | 144 | } |
| 145 | + | |
| 146 | +bool | |
| 147 | +QPDFMatrix::operator==(QPDFMatrix const& rhs) const | |
| 148 | +{ | |
| 149 | + return ((this->a == rhs.a) && | |
| 150 | + (this->b == rhs.b) && | |
| 151 | + (this->c == rhs.c) && | |
| 152 | + (this->d == rhs.d) && | |
| 153 | + (this->e == rhs.e) && | |
| 154 | + (this->f == rhs.f)); | |
| 155 | +} | ... | ... |