diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-02-18 17:27:25 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-02-20 00:35:19 +0100 |
commit | 71e86272859aa2794263cc59446a20a826d6d3aa (patch) | |
tree | 59a077b5cd05be0c4c75ac12181afd6645dad98f /libqpdf/QPDFMatrix.cc | |
parent | de8929a41ce093a0c21ca48b2342a73cf67a51f0 (diff) | |
download | qpdf-71e86272859aa2794263cc59446a20a826d6d3aa.tar.zst |
Add const versions of QPDFMatrix::transform*
Diffstat (limited to 'libqpdf/QPDFMatrix.cc')
-rw-r--r-- | libqpdf/QPDFMatrix.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libqpdf/QPDFMatrix.cc b/libqpdf/QPDFMatrix.cc index 18122d72..2b269099 100644 --- a/libqpdf/QPDFMatrix.cc +++ b/libqpdf/QPDFMatrix.cc @@ -111,6 +111,12 @@ QPDFMatrix::rotatex90(int angle) void QPDFMatrix::transform(double x, double y, double& xp, double& yp) { + const_cast<QPDFMatrix const*>(this)->transform(x, y, xp, yp); +} + +void +QPDFMatrix::transform(double x, double y, double& xp, double& yp) const +{ xp = (this->a * x) + (this->c * y) + this->e; yp = (this->b * x) + (this->d * y) + this->f; } @@ -118,6 +124,12 @@ QPDFMatrix::transform(double x, double y, double& xp, double& yp) QPDFObjectHandle::Rectangle QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) { + return const_cast<QPDFMatrix const*>(this)->transformRectangle(r); +} + +QPDFObjectHandle::Rectangle +QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const +{ std::vector<double> tx(4); std::vector<double> ty(4); transform(r.llx, r.lly, tx.at(0), ty.at(0)); |