Skip to content

Commit

Permalink
x11-libs/agg: Fix C++17 does not allow register storage class
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/894708
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
  • Loading branch information
listout committed Sep 9, 2023
1 parent 1cede46 commit 428b970
Show file tree
Hide file tree
Showing 17 changed files with 1,115 additions and 0 deletions.
62 changes: 62 additions & 0 deletions x11-libs/agg/agg-2.5-r4.ebuild
@@ -0,0 +1,62 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit autotools

DESCRIPTION="High quality rendering engine library for C++"
HOMEPAGE="http://antigrain.com/"
SRC_URI="http://antigrain.com/${P}.tar.gz"

LICENSE="GPL-2 gpc? ( free-noncomm )"
SLOT="0"
KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="+gpc sdl static-libs +truetype +X"

# preffer X with enabled xcb, really
RDEPEND="
sdl? ( >=media-libs/libsdl-1.2.0[X?] )
X? ( >=x11-libs/libX11-1.3.99.901 )
truetype? ( media-libs/freetype:2 )
"
DEPEND="${RDEPEND}
virtual/pkgconfig
"

DOCS=( readme authors ChangeLog news )

# patches taken from fedora
PATCHES=(
"${FILESDIR}"/agg-2.4-depends.patch
"${FILESDIR}"/${P}-pkgconfig.patch
"${FILESDIR}"/${P}-autotools.patch
"${FILESDIR}"/${P}-sdl-m4.patch
"${FILESDIR}"/${P}-sdl-automagic.patch
"${FILESDIR}"/${P}-gcc8.patch
"${FILESDIR}"/${PVR}
"${FILESDIR}"/${P}-drop-register-keyword.patch
)

src_prepare() {
default
mv configure.{in,ac} || die
AT_M4DIR="." eautoreconf
}

src_configure() {
local myeconfargs=(
--disable-ctrl
--disable-examples
$(use_enable gpc)
$(use_enable sdl)
$(use_enable static-libs static)
$(use_enable truetype freetype)
$(use_with X x)
)
econf ${myeconfargs[@]}
}

src_install() {
default
find "${D}" -name '*.la' -delete || die
}
@@ -0,0 +1,81 @@
From efd33aad5e69f36ab343b1f28839a55db4538104 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 10:55:37 +0100
Subject: [PATCH 01/15] Fix non-terminating loop conditions when len=1

- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
+ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
}
---
include/agg_renderer_outline_aa.h | 8 ++++----
include/agg_renderer_outline_image.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/agg_renderer_outline_aa.h b/include/agg_renderer_outline_aa.h
index ce25a2e..cb2aa00 100644
--- a/include/agg_renderer_outline_aa.h
+++ b/include/agg_renderer_outline_aa.h
@@ -1659,7 +1659,7 @@ namespace agg
}
else
{
- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
+ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@@ -1726,7 +1726,7 @@ namespace agg
}
else
{
- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
+ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;
@@ -1798,7 +1798,7 @@ namespace agg
}
else
{
- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
+ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@@ -1811,7 +1811,7 @@ namespace agg
}
else
{
- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
+ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;
diff --git a/include/agg_renderer_outline_image.h b/include/agg_renderer_outline_image.h
index fbfac10..66d2b9a 100644
--- a/include/agg_renderer_outline_image.h
+++ b/include/agg_renderer_outline_image.h
@@ -969,7 +969,7 @@ namespace agg
}
else
{
- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
+ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
{
sx = (lp.x1 + sx) >> 1;
sy = (lp.y1 + sy) >> 1;
@@ -982,7 +982,7 @@ namespace agg
}
else
{
- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
+ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
{
ex = (lp.x2 + ex) >> 1;
ey = (lp.y2 + ey) >> 1;
--
1.8.1.4

@@ -0,0 +1,40 @@
From e269fe9b62af6fe314cebe0ee7a6d6d1a4a84d1c Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 11:03:26 +0100
Subject: [PATCH 02/15] Cure recursion by aborting if the co-ordinates are to
big to handle

---
include/agg_rasterizer_cells_aa.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/agg_rasterizer_cells_aa.h b/include/agg_rasterizer_cells_aa.h
index d3bb138..3a616d9 100644
--- a/include/agg_rasterizer_cells_aa.h
+++ b/include/agg_rasterizer_cells_aa.h
@@ -40,7 +40,8 @@
#define AGG_RASTERIZER_CELLS_AA_INCLUDED

#include <string.h>
-#include <math.h>
+#include <cstdlib>
+#include <limits>
#include "agg_math.h"
#include "agg_array.h"

@@ -333,6 +334,12 @@ namespace agg
{
int cx = (x1 + x2) >> 1;
int cy = (y1 + y2) >> 1;
+
+ // Bail if values are so large they are likely to wrap
+ if ((std::abs(x1) >= std::numeric_limits<int>::max()/2) || (std::abs(y1) >= std::numeric_limits<int>::max()/2) ||
+ (std::abs(x2) >= std::numeric_limits<int>::max()/2) || (std::abs(y2) >= std::numeric_limits<int>::max()/2))
+ return;
+
line(x1, y1, cx, cy);
line(cx, cy, x2, y2);
}
--
1.8.1.4

@@ -0,0 +1,30 @@
From 032d5342430f4c5dfbc34a2817d67386a14fd51b Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 11:40:49 +0100
Subject: [PATCH 03/15] Get coordinates from previous vertex if last command is
path_cmd_end_poly

---
include/agg_path_storage.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/agg_path_storage.h b/include/agg_path_storage.h
index 7be7393..8922fc8 100644
--- a/include/agg_path_storage.h
+++ b/include/agg_path_storage.h
@@ -878,6 +878,12 @@ namespace agg
*x += x2;
*y += y2;
}
+ else if (!is_stop(m_vertices.last_command()) &&
+ is_vertex(m_vertices.prev_vertex(&x2, &y2)))
+ {
+ *x += x2;
+ *y += y2;
+ }
}
}

--
1.8.1.4

@@ -0,0 +1,138 @@
From b9c4b1c72b4ad6b24c37f402d3eec39ef393b0eb Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 14:17:43 +0100
Subject: [PATCH 04/15] Make rasterizer_outline_aa ignore close_polygon when
vertex count < 3

---
include/agg_rasterizer_outline_aa.h | 107 ++++++++++++++++++------------------
1 file changed, 52 insertions(+), 55 deletions(-)

diff --git a/include/agg_rasterizer_outline_aa.h b/include/agg_rasterizer_outline_aa.h
index 4d6dd57..24301d5 100644
--- a/include/agg_rasterizer_outline_aa.h
+++ b/include/agg_rasterizer_outline_aa.h
@@ -333,68 +333,65 @@ namespace agg
int y2;
int lprev;

- if(close_polygon)
+ if(close_polygon && (m_src_vertices.size() >= 3))
{
- if(m_src_vertices.size() >= 3)
+ dv.idx = 2;
+
+ v = &m_src_vertices[m_src_vertices.size() - 1];
+ x1 = v->x;
+ y1 = v->y;
+ lprev = v->len;
+
+ v = &m_src_vertices[0];
+ x2 = v->x;
+ y2 = v->y;
+ dv.lcurr = v->len;
+ line_parameters prev(x1, y1, x2, y2, lprev);
+
+ v = &m_src_vertices[1];
+ dv.x1 = v->x;
+ dv.y1 = v->y;
+ dv.lnext = v->len;
+ dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
+
+ v = &m_src_vertices[dv.idx];
+ dv.x2 = v->x;
+ dv.y2 = v->y;
+ dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
+
+ dv.xb1 = 0;
+ dv.yb1 = 0;
+ dv.xb2 = 0;
+ dv.yb2 = 0;
+
+ switch(m_line_join)
{
- dv.idx = 2;
-
- v = &m_src_vertices[m_src_vertices.size() - 1];
- x1 = v->x;
- y1 = v->y;
- lprev = v->len;
-
- v = &m_src_vertices[0];
- x2 = v->x;
- y2 = v->y;
- dv.lcurr = v->len;
- line_parameters prev(x1, y1, x2, y2, lprev);
-
- v = &m_src_vertices[1];
- dv.x1 = v->x;
- dv.y1 = v->y;
- dv.lnext = v->len;
- dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
-
- v = &m_src_vertices[dv.idx];
- dv.x2 = v->x;
- dv.y2 = v->y;
- dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
-
- dv.xb1 = 0;
- dv.yb1 = 0;
- dv.xb2 = 0;
- dv.yb2 = 0;
-
- switch(m_line_join)
- {
- case outline_no_join:
- dv.flags = 3;
- break;
+ case outline_no_join:
+ dv.flags = 3;
+ break;

- case outline_miter_join:
- case outline_round_join:
- dv.flags =
- (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
- ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
- break;
+ case outline_miter_join:
+ case outline_round_join:
+ dv.flags =
+ (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
+ ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
+ break;

- case outline_miter_accurate_join:
- dv.flags = 0;
- break;
- }
+ case outline_miter_accurate_join:
+ dv.flags = 0;
+ break;
+ }

- if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
- {
- bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
- }
+ if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
+ {
+ bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
+ }

- if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
- {
- bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
- }
- draw(dv, 0, m_src_vertices.size());
+ if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
+ {
+ bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
}
+ draw(dv, 0, m_src_vertices.size());
}
else
{
--
1.8.1.4

0 comments on commit 428b970

Please sign in to comment.