summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/Pair.hpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2023-01-12 03:01:29 +0000
commit6a7900c93acc16d1bbd2f1e26286c7dd7387e6c0 (patch)
tree76196287351cba68a51934c49468bf1a7846aa76 /dviware/dvisvgm/src/Pair.hpp
parentc1c19023b4b1d43cb874f84df5102b485853e672 (diff)
CTAN sync 202301120301
Diffstat (limited to 'dviware/dvisvgm/src/Pair.hpp')
-rw-r--r--dviware/dvisvgm/src/Pair.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/dviware/dvisvgm/src/Pair.hpp b/dviware/dvisvgm/src/Pair.hpp
index 44236717ef..c1fdd5b6d5 100644
--- a/dviware/dvisvgm/src/Pair.hpp
+++ b/dviware/dvisvgm/src/Pair.hpp
@@ -2,7 +2,7 @@
** Pair.hpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2022 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2023 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -73,6 +73,7 @@ inline T det (const Pair<T> &p1, const Pair<T> &p2) {
struct Pair32 : public Pair<int32_t> {
explicit Pair32 (int32_t x=0, int32_t y=0) : Pair<int32_t>(x, y) {}
explicit Pair32 (double x, double y) : Pair<int32_t>(lround(x), lround(y)) {}
+ explicit Pair32 (const Pair<double> &p) : Pair32(p.x(), p.y()) {}
Pair32 (const Pair<int32_t> &p) : Pair<int32_t>(p) {}
};
@@ -82,6 +83,11 @@ inline DPair round (const DPair &p) {
return DPair(std::lround(p.x()), std::lround(p.y()));
}
+
+template<> template<>
+inline Pair<int>::Pair (const Pair<double> &p) : _x(int(round(p.x()))), _y(int(round(p.y()))) {}
+
+
template <typename T>
IMPLEMENT_ARITHMETIC_OPERATOR(Pair<T>, +)