From 61f5dbcf52ec1f319388649c3fc0754f40c1dc23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 30 Aug 2021 16:08:10 +0200 Subject: [PATCH] Patch for geompp library --- debian/patches/02-geompp.patch | 481 +++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 482 insertions(+) create mode 100644 debian/patches/02-geompp.patch diff --git a/debian/patches/02-geompp.patch b/debian/patches/02-geompp.patch new file mode 100644 index 0000000..2640281 --- /dev/null +++ b/debian/patches/02-geompp.patch @@ -0,0 +1,481 @@ +Description: Patch-in dependency library 'geompp' + 'geompp' is a GPL-3 licensed header-only helper-library by giada-upstream + that is only referenced via a gitmodule; we include it via quilt +Author: Giovanni A. Zuliani | Monocasual +Origin: upstream +Forwarded: not-needed +Last-Update: 2021-08-30 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- /dev/null ++++ giada/src/deps/geompp/src/line.hpp +@@ -0,0 +1,81 @@ ++/* ----------------------------------------------------------------------------- ++ * ++ * geompp - Basic geometrical utilities for C++. ++ * ++ * ----------------------------------------------------------------------------- ++ * ++ * Copyright (C) 2021 Giovanni A. Zuliani | Monocasual Laboratories ++ * ++ * This file is part of geompp - Basic geometrical utilities for C++. ++ * ++ * geompp - Basic geometrical utilities for C++ is free software: you can ++ * redistribute it and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software Foundation, either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * geompp - Basic geometrical utilities for C++ is distributed in the hope that ++ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with geompp - Basic geometrical utilities for C++. If not, see ++ * . ++ * ++ * -------------------------------------------------------------------------- */ ++ ++#ifndef GEOMPP_LINE_HH ++#define GEOMPP_LINE_HH ++ ++namespace geompp ++{ ++template ++class Line ++{ ++public: ++ /* Line (1) - invalid. */ ++ ++ constexpr Line() ++ : Line(0, 0, 0, 0) ++ { ++ } ++ ++ /* Line (2) - normal. */ ++ ++ constexpr Line(T x1, T y1, T x2, T y2) ++ : x1(x1) ++ , y1(y1) ++ , x2(x2) ++ , y2(y2) ++ { ++ } ++ ++ /* shiftX ++ Horizontally shifts the line of a certain amount. */ ++ ++ void shiftX(T amount) ++ { ++ x1 += amount; ++ x2 += amount; ++ } ++ ++ /* with[...] ++ Returns a copy of this Line with new coordintates. */ ++ ++ Line withX1(T v) const { return {v, y1, x2, y2}; } ++ Line withY1(T v) const { return {x1, v, x2, y2}; } ++ Line withX2(T v) const { return {x1, y1, v, y2}; } ++ Line withY2(T v) const { return {x1, y1, x2, v}; } ++ Line withX(T v) const { return {v, y1, v, y2}; } ++ Line withY(T v) const { return {x1, v, x2, v}; } ++ ++ /* withShiftedX ++ Returns a new Line horizontally shifted by a certain amount. */ ++ ++ Line withShiftedX(T amount) const { return {x1 + amount, y1, x2 + amount, y2}; } ++ ++ T x1, y1, x2, y2; ++}; ++} // namespace geompp ++ ++#endif +\ No newline at end of file +--- /dev/null ++++ giada/src/deps/geompp/src/point.hpp +@@ -0,0 +1,80 @@ ++/* ----------------------------------------------------------------------------- ++ * ++ * geompp - Basic geometrical utilities for C++. ++ * ++ * ----------------------------------------------------------------------------- ++ * ++ * Copyright (C) 2021 Giovanni A. Zuliani | Monocasual Laboratories ++ * ++ * This file is part of geompp - Basic geometrical utilities for C++. ++ * ++ * geompp - Basic geometrical utilities for C++ is free software: you can ++ * redistribute it and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software Foundation, either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * geompp - Basic geometrical utilities for C++ is distributed in the hope that ++ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with geompp - Basic geometrical utilities for C++. If not, see ++ * . ++ * ++ * -------------------------------------------------------------------------- */ ++ ++#ifndef GEOMPP_POINT_HH ++#define GEOMPP_POINT_HH ++ ++#include ++ ++namespace geompp ++{ ++template ++class Point ++{ ++public: ++ constexpr Point() ++ : Point(0, 0) ++ { ++ } ++ ++ constexpr Point(T x, T y) ++ : x(x) ++ , y(y) ++ { ++ } ++ ++ bool operator==(const Point& o) const ++ { ++ return x == o.x && y == o.y; ++ } ++ ++ bool operator!=(const Point& o) const ++ { ++ return !(*this == o); ++ } ++ ++ Point operator+(const Point& o) const ++ { ++ return {x + o.x, y + o.y}; ++ } ++ ++ Point operator-(const Point& o) const ++ { ++ return {x - o.x, y - o.y}; ++ } ++ ++ /* with[...] ++ Returns a copy of this Point with a new coordinate. */ ++ ++ Point withX(T v) const { return {v, y}; } ++ Point withY(T v) const { return {x, v}; } ++ ++ T x; ++ T y; ++}; ++} // namespace geompp ++ ++#endif +--- /dev/null ++++ giada/src/deps/geompp/src/range.hpp +@@ -0,0 +1,61 @@ ++/* ----------------------------------------------------------------------------- ++ * ++ * geompp - Basic geometrical utilities for C++. ++ * ++ * ----------------------------------------------------------------------------- ++ * ++ * Copyright (C) 2021 Giovanni A. Zuliani | Monocasual Laboratories ++ * ++ * This file is part of geompp - Basic geometrical utilities for C++. ++ * ++ * geompp - Basic geometrical utilities for C++ is free software: you can ++ * redistribute it and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software Foundation, either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * geompp - Basic geometrical utilities for C++ is distributed in the hope that ++ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with geompp - Basic geometrical utilities for C++. If not, see ++ * . ++ * ++ * -------------------------------------------------------------------------- */ ++ ++#ifndef GEOMPP_RANGE_HH ++#define GEOMPP_RANGE_HH ++ ++#include ++ ++namespace geompp ++{ ++template ++class Range ++{ ++public: ++ constexpr Range() ++ : Range(0, 0) ++ { ++ } ++ ++ constexpr Range(T a, T b) ++ : a(a) ++ , b(b) ++ { ++ assert(a < b); ++ } ++ ++ T getLength() const { return b - a; } ++ ++ bool contains(T t) const ++ { ++ return t >= a && t < b; ++ } ++ ++ T a, b; ++}; ++} // namespace geompp ++ ++#endif +--- /dev/null ++++ giada/src/deps/geompp/src/rect.hpp +@@ -0,0 +1,236 @@ ++/* ----------------------------------------------------------------------------- ++ * ++ * geompp - Basic geometrical utilities for C++. ++ * ++ * ----------------------------------------------------------------------------- ++ * ++ * Copyright (C) 2021 Giovanni A. Zuliani | Monocasual Laboratories ++ * ++ * This file is part of geompp - Basic geometrical utilities for C++. ++ * ++ * geompp - Basic geometrical utilities for C++ is free software: you can ++ * redistribute it and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software Foundation, either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * geompp - Basic geometrical utilities for C++ is distributed in the hope that ++ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with geompp - Basic geometrical utilities for C++. If not, see ++ * . ++ * ++ * -------------------------------------------------------------------------- */ ++ ++#ifndef GEOMPP_RECT_HH ++#define GEOMPP_RECT_HH ++ ++#include "line.hpp" ++#include "point.hpp" ++#include "range.hpp" ++ ++namespace geompp ++{ ++template ++class Rect ++{ ++public: ++ /* Rect (1) ++ Invalid rectangle. */ ++ ++ constexpr Rect() ++ : Rect(0, 0, 0, 0) ++ { ++ } ++ ++ /* Rect (2) ++ Normal rectangle. */ ++ ++ constexpr Rect(T x, T y, T w, T h) ++ : x(x) ++ , y(y) ++ , w(w) ++ , h(h) ++ , xw(x + w) ++ , yh(y + h) ++ { ++ } ++ ++ void setX(T v) ++ { ++ x = v; ++ xw = x + w; ++ } ++ ++ void setY(T v) ++ { ++ y = v; ++ yh = y + h; ++ } ++ ++ void setW(T v) ++ { ++ w = v; ++ xw = x + w; ++ } ++ ++ void setH(T v) ++ { ++ h = v; ++ yh = y + h; ++ } ++ ++ /* setPosition ++ Sets the top-left corner to Point 'p'. */ ++ ++ void setPosition(Point p) ++ { ++ setX(p.x); ++ setY(p.y); ++ } ++ ++ /* shift[...] ++ Shifts the rectangle by a certain amount. */ ++ ++ void shiftX(T amount) ++ { ++ x += amount; ++ xw = x + w; ++ } ++ ++ void shiftY(T amount) ++ { ++ y += amount; ++ yh = y + h; ++ } ++ ++ /* trim[..] ++ Removes 'amount' from the one of the edges. */ ++ ++ void trimLeft(T amount) ++ { ++ x += amount; ++ w -= amount; ++ } ++ ++ void trimRight(T amount) ++ { ++ w -= amount; ++ xw = x + w; ++ } ++ ++ void trimTop(T amount) ++ { ++ y += amount; ++ h -= amount; ++ } ++ ++ void trimBottom(T amount) ++ { ++ h -= amount; ++ yh = y + h; ++ } ++ ++ /* reduce (1) ++ Reduces width and height by a certain amount around the center point. */ ++ ++ void reduce(T amountX, T amountY) ++ { ++ x += amountX; ++ y += amountY; ++ w -= amountX * 2; ++ h -= amountY * 2; ++ xw = x + w; ++ yh = y + h; ++ } ++ ++ /* reduce (2) ++ Reduces all four sides by a certain amount around the center point. */ ++ ++ void reduce(T amount) { reduce(amount, amount); } ++ ++ /* isValid ++ True if this Rect has size greater than zero. */ ++ ++ bool isValid() const { return w > 0 && h > 0; } ++ ++ /* with[...] ++ Returns a copy of this Rect with a new position/size. */ ++ ++ Rect withX(T v) const { return {v, y, w, h}; } ++ Rect withY(T v) const { return {x, v, w, h}; } ++ Rect withW(T v) const { return {x, y, v, h}; } ++ Rect withH(T v) const { return {x, y, w, v}; } ++ ++ /* withPosition ++ Returns a copy of this Rect with a new top-left corner given by Point 'p'. */ ++ ++ Rect withPosition(Point p) const { return {p.x, p.y, w, h}; } ++ ++ /* withShifted[...] ++ Returns a copy of this Rect shifted by a certain amount. */ ++ ++ Rect withShiftedX(T amount) const { return {x + amount, y, w, h}; } ++ Rect withShiftedY(T amount) const { return {x, y + amount, w, h}; } ++ ++ /* withTrimmed[...] ++ Returns a copy of this Rect with 'amount' removed from the one of the ++ edges. */ ++ ++ Rect withTrimmedLeft(T amount) const { return {x + amount, y, w - amount, h}; } ++ Rect withTrimmedRight(T amount) const { return {x, y, w - amount, h}; } ++ Rect withTrimmedTop(T amount) const { return {x, y + amount, w, h - amount}; } ++ Rect withTrimmedBottom(T amount) const { return {x, y, w, h - amount}; } ++ ++ /* get[Width|Height]AsLine ++ Returns width or height as a new Line object. */ ++ ++ Line getWidthAsLine() const { return Line(x, y, xw - 1, y); } ++ Line getHeightAsLine() const { return Line(x, y, x, yh - 1); } ++ ++ Point getPosition() const { return Point(x, y); } ++ ++ /* reduced (1) ++ Returns a copy of this Rect with width and height reduced by a certain ++ amount. */ ++ ++ Rect reduced(T amountX, T amountY) const ++ { ++ Rect r = *this; ++ r.reduce(amountX, amountY); ++ return r; ++ } ++ ++ /* reduced (2) ++ Returns a copy of this Rect with all four sides reduced by a certain amount ++ around the center point. */ ++ ++ Rect reduced(T amount) const ++ { ++ return reduced(amount, amount); ++ } ++ ++ /* contains (1) ++ Returns true if Point p is inside this Rect. */ ++ ++ bool contains(Point p) const ++ { ++ return p.x >= x && p.y >= y && p.x < xw && p.y < yh; ++ } ++ ++ /* contains (2) ++ Returns true if Line l is inside this Rect. */ ++ ++ bool contains(Line l) const ++ { ++ return l.x1 >= x && l.x1 < xw && l.x2 >= x && l.x2 < xw && ++ l.y1 >= y && l.y1 < yh && l.y2 >= y && l.y2 < yh; ++ } ++ ++ T x, y, w, h, xw, yh; ++}; ++} // namespace geompp ++ ++#endif +\ No newline at end of file diff --git a/debian/patches/series b/debian/patches/series index 71bba89..cec1d96 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 01-spelling-fixes.patch +02-geompp.patch 03-system-rtaudio.patch 04-system-json.patch -- 2.30.2