Commit a2124f992c7a3c2695b93cf7fe9298c3a862ffc9
1 parent
552303a9
Add QPDFMatrix::operator==
Showing
3 changed files
with
23 additions
and
0 deletions
ChangeLog
| 1 | 2021-03-03 Jay Berkenbilt <ejb@ql.org> | 1 | 2021-03-03 Jay Berkenbilt <ejb@ql.org> |
| 2 | 2 | ||
| 3 | + * Add QPDFMatrix::operator== | ||
| 4 | + | ||
| 3 | * Add QPDFObjectHandle::makeResourcesIndirect | 5 | * Add QPDFObjectHandle::makeResourcesIndirect |
| 4 | 6 | ||
| 5 | 2021-03-02 Jay Berkenbilt <ejb@ql.org> | 7 | 2021-03-02 Jay Berkenbilt <ejb@ql.org> |
include/qpdf/QPDFMatrix.hh
| @@ -90,6 +90,16 @@ class QPDFMatrix | @@ -90,6 +90,16 @@ class QPDFMatrix | ||
| 90 | QPDFObjectHandle::Rectangle transformRectangle( | 90 | QPDFObjectHandle::Rectangle transformRectangle( |
| 91 | QPDFObjectHandle::Rectangle r); | 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 | double a; | 103 | double a; |
| 94 | double b; | 104 | double b; |
| 95 | double c; | 105 | double c; |
libqpdf/QPDFMatrix.cc
| @@ -142,3 +142,14 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const | @@ -142,3 +142,14 @@ QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const | ||
| 142 | *std::max_element(tx.begin(), tx.end()), | 142 | *std::max_element(tx.begin(), tx.end()), |
| 143 | *std::max_element(ty.begin(), ty.end())); | 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 | +} |