Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-libs/agg/, x11-libs/agg/files/, x11-libs/agg/files/2.5/
Date: Mon, 28 May 2018 17:55:36
Message-Id: 1527530124.dd74171ee16a87765e1811bac6b58188ea573869.pacho@gentoo
1 commit: dd74171ee16a87765e1811bac6b58188ea573869
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 28 17:52:22 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Mon May 28 17:55:24 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd74171e
7
8 x11-libs/agg: Get newer fixed ebuild from sci overlay
9
10 Package-Manager: Portage-2.3.38, Repoman-2.3.9
11
12 x11-libs/agg/agg-2.5-r3.ebuild | 56 ++++++
13 ...on-terminating-loop-conditions-when-len-1.patch | 81 +++++++++
14 ...ion-by-aborting-if-the-co-ordinates-are-t.patch | 40 +++++
15 ...ates-from-previous-vertex-if-last-command.patch | 30 ++++
16 ...izer_outline_aa-ignore-close_polygon-when.patch | 138 +++++++++++++++
17 .../files/2.5/0005-Remove-VC-6-workaround.patch | 52 ++++++
18 ...-Implement-grain-merge-blending-mode-GIMP.patch | 85 +++++++++
19 ...mplement-grain-extract-blending-mode-GIMP.patch | 85 +++++++++
20 ...tiplication-and-division-operators-as-con.patch | 36 ++++
21 ...0009-Add-a-static-identity-transformation.patch | 37 ++++
22 .../2.5/0010-Add-renderer_scanline_aa_alpha.patch | 193 +++++++++++++++++++++
23 ...Avoid-division-by-zero-in-color-burn-mode.patch | 58 +++++++
24 ...12-Avoid-pixel-artifacts-when-compositing.patch | 26 +++
25 ...conv-classes-to-allow-access-to-the-origi.patch | 93 ++++++++++
26 ...tial-zero-division-resulting-in-nan-in-ag.patch | 30 ++++
27 ...t-value-in-the-gamma-table-is-always-zero.patch | 24 +++
28 x11-libs/agg/files/agg-2.4-depends.patch | 48 +++++
29 x11-libs/agg/files/agg-2.5-autotools.patch | 11 ++
30 x11-libs/agg/files/agg-2.5-pkgconfig.patch | 10 ++
31 x11-libs/agg/files/agg-2.5-sdl-automagic.patch | 26 +++
32 x11-libs/agg/files/agg-2.5-sdl-m4.patch | 186 ++++++++++++++++++++
33 21 files changed, 1345 insertions(+)
34
35 diff --git a/x11-libs/agg/agg-2.5-r3.ebuild b/x11-libs/agg/agg-2.5-r3.ebuild
36 new file mode 100644
37 index 00000000000..d9bf36876ff
38 --- /dev/null
39 +++ b/x11-libs/agg/agg-2.5-r3.ebuild
40 @@ -0,0 +1,56 @@
41 +# Copyright 1999-2018 Gentoo Foundation
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=6
45 +
46 +inherit autotools
47 +
48 +DESCRIPTION="High quality rendering engine library for C++"
49 +HOMEPAGE="http://antigrain.com/"
50 +SRC_URI="http://antigrain.com/${P}.tar.gz"
51 +
52 +LICENSE="GPL-2 gpc? ( free-noncomm )"
53 +SLOT="0"
54 +KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
55 +IUSE="+gpc sdl static-libs +truetype +X"
56 +
57 +# preffer X with enabled xcb, really
58 +RDEPEND="
59 + sdl? ( >=media-libs/libsdl-1.2.0[X?] )
60 + X? ( >=x11-libs/libX11-1.3.99.901 )
61 + truetype? ( media-libs/freetype:2 )
62 +"
63 +DEPEND="${RDEPEND}
64 + virtual/pkgconfig
65 +"
66 +
67 +DOCS=( readme authors ChangeLog news )
68 +
69 +# patches taken from fedora
70 +PATCHES=(
71 + "${FILESDIR}"/agg-2.4-depends.patch
72 + "${FILESDIR}"/${P}-pkgconfig.patch
73 + "${FILESDIR}"/${P}-autotools.patch
74 + "${FILESDIR}"/${P}-sdl-m4.patch
75 + "${FILESDIR}"/${P}-sdl-automagic.patch
76 + "${FILESDIR}"/${PV}
77 +)
78 +
79 +src_prepare() {
80 + default
81 + mv configure.{in,ac} || die
82 + AT_M4DIR="." eautoreconf
83 +}
84 +
85 +src_configure() {
86 + local myeconfargs=(
87 + --disable-ctrl
88 + --disable-examples
89 + --disable-dependency-tracking
90 + $(use_enable gpc)
91 + $(use_enable sdl)
92 + $(use_enable truetype freetype)
93 + $(use_with X x)
94 + )
95 + econf ${myeconfargs[@]}
96 +}
97
98 diff --git a/x11-libs/agg/files/2.5/0001-Fix-non-terminating-loop-conditions-when-len-1.patch b/x11-libs/agg/files/2.5/0001-Fix-non-terminating-loop-conditions-when-len-1.patch
99 new file mode 100644
100 index 00000000000..eaf0467fb84
101 --- /dev/null
102 +++ b/x11-libs/agg/files/2.5/0001-Fix-non-terminating-loop-conditions-when-len-1.patch
103 @@ -0,0 +1,81 @@
104 +From efd33aad5e69f36ab343b1f28839a55db4538104 Mon Sep 17 00:00:00 2001
105 +From: Tom Hughes <tom@×××××××.nu>
106 +Date: Sun, 19 May 2013 10:55:37 +0100
107 +Subject: [PATCH 01/15] Fix non-terminating loop conditions when len=1
108 +
109 +- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
110 ++ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
111 + {
112 + sx = (lp.x1 + sx) >> 1;
113 + sy = (lp.y1 + sy) >> 1;
114 + }
115 +---
116 + include/agg_renderer_outline_aa.h | 8 ++++----
117 + include/agg_renderer_outline_image.h | 4 ++--
118 + 2 files changed, 6 insertions(+), 6 deletions(-)
119 +
120 +diff --git a/include/agg_renderer_outline_aa.h b/include/agg_renderer_outline_aa.h
121 +index ce25a2e..cb2aa00 100644
122 +--- a/include/agg_renderer_outline_aa.h
123 ++++ b/include/agg_renderer_outline_aa.h
124 +@@ -1659,7 +1659,7 @@ namespace agg
125 + }
126 + else
127 + {
128 +- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
129 ++ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
130 + {
131 + sx = (lp.x1 + sx) >> 1;
132 + sy = (lp.y1 + sy) >> 1;
133 +@@ -1726,7 +1726,7 @@ namespace agg
134 + }
135 + else
136 + {
137 +- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
138 ++ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
139 + {
140 + ex = (lp.x2 + ex) >> 1;
141 + ey = (lp.y2 + ey) >> 1;
142 +@@ -1798,7 +1798,7 @@ namespace agg
143 + }
144 + else
145 + {
146 +- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
147 ++ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
148 + {
149 + sx = (lp.x1 + sx) >> 1;
150 + sy = (lp.y1 + sy) >> 1;
151 +@@ -1811,7 +1811,7 @@ namespace agg
152 + }
153 + else
154 + {
155 +- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
156 ++ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
157 + {
158 + ex = (lp.x2 + ex) >> 1;
159 + ey = (lp.y2 + ey) >> 1;
160 +diff --git a/include/agg_renderer_outline_image.h b/include/agg_renderer_outline_image.h
161 +index fbfac10..66d2b9a 100644
162 +--- a/include/agg_renderer_outline_image.h
163 ++++ b/include/agg_renderer_outline_image.h
164 +@@ -969,7 +969,7 @@ namespace agg
165 + }
166 + else
167 + {
168 +- while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len)
169 ++ while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len)
170 + {
171 + sx = (lp.x1 + sx) >> 1;
172 + sy = (lp.y1 + sy) >> 1;
173 +@@ -982,7 +982,7 @@ namespace agg
174 + }
175 + else
176 + {
177 +- while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len)
178 ++ while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len)
179 + {
180 + ex = (lp.x2 + ex) >> 1;
181 + ey = (lp.y2 + ey) >> 1;
182 +--
183 +1.8.1.4
184 +
185
186 diff --git a/x11-libs/agg/files/2.5/0002-Cure-recursion-by-aborting-if-the-co-ordinates-are-t.patch b/x11-libs/agg/files/2.5/0002-Cure-recursion-by-aborting-if-the-co-ordinates-are-t.patch
187 new file mode 100644
188 index 00000000000..4fe74341ed6
189 --- /dev/null
190 +++ b/x11-libs/agg/files/2.5/0002-Cure-recursion-by-aborting-if-the-co-ordinates-are-t.patch
191 @@ -0,0 +1,40 @@
192 +From e269fe9b62af6fe314cebe0ee7a6d6d1a4a84d1c Mon Sep 17 00:00:00 2001
193 +From: Tom Hughes <tom@×××××××.nu>
194 +Date: Sun, 19 May 2013 11:03:26 +0100
195 +Subject: [PATCH 02/15] Cure recursion by aborting if the co-ordinates are to
196 + big to handle
197 +
198 +---
199 + include/agg_rasterizer_cells_aa.h | 9 ++++++++-
200 + 1 file changed, 8 insertions(+), 1 deletion(-)
201 +
202 +diff --git a/include/agg_rasterizer_cells_aa.h b/include/agg_rasterizer_cells_aa.h
203 +index d3bb138..3a616d9 100644
204 +--- a/include/agg_rasterizer_cells_aa.h
205 ++++ b/include/agg_rasterizer_cells_aa.h
206 +@@ -40,7 +40,8 @@
207 + #define AGG_RASTERIZER_CELLS_AA_INCLUDED
208 +
209 + #include <string.h>
210 +-#include <math.h>
211 ++#include <cstdlib>
212 ++#include <limits>
213 + #include "agg_math.h"
214 + #include "agg_array.h"
215 +
216 +@@ -333,6 +334,12 @@ namespace agg
217 + {
218 + int cx = (x1 + x2) >> 1;
219 + int cy = (y1 + y2) >> 1;
220 ++
221 ++ // Bail if values are so large they are likely to wrap
222 ++ if ((std::abs(x1) >= std::numeric_limits<int>::max()/2) || (std::abs(y1) >= std::numeric_limits<int>::max()/2) ||
223 ++ (std::abs(x2) >= std::numeric_limits<int>::max()/2) || (std::abs(y2) >= std::numeric_limits<int>::max()/2))
224 ++ return;
225 ++
226 + line(x1, y1, cx, cy);
227 + line(cx, cy, x2, y2);
228 + }
229 +--
230 +1.8.1.4
231 +
232
233 diff --git a/x11-libs/agg/files/2.5/0003-Get-coordinates-from-previous-vertex-if-last-command.patch b/x11-libs/agg/files/2.5/0003-Get-coordinates-from-previous-vertex-if-last-command.patch
234 new file mode 100644
235 index 00000000000..b12684d18d2
236 --- /dev/null
237 +++ b/x11-libs/agg/files/2.5/0003-Get-coordinates-from-previous-vertex-if-last-command.patch
238 @@ -0,0 +1,30 @@
239 +From 032d5342430f4c5dfbc34a2817d67386a14fd51b Mon Sep 17 00:00:00 2001
240 +From: Tom Hughes <tom@×××××××.nu>
241 +Date: Sun, 19 May 2013 11:40:49 +0100
242 +Subject: [PATCH 03/15] Get coordinates from previous vertex if last command is
243 + path_cmd_end_poly
244 +
245 +---
246 + include/agg_path_storage.h | 6 ++++++
247 + 1 file changed, 6 insertions(+)
248 +
249 +diff --git a/include/agg_path_storage.h b/include/agg_path_storage.h
250 +index 7be7393..8922fc8 100644
251 +--- a/include/agg_path_storage.h
252 ++++ b/include/agg_path_storage.h
253 +@@ -878,6 +878,12 @@ namespace agg
254 + *x += x2;
255 + *y += y2;
256 + }
257 ++ else if (!is_stop(m_vertices.last_command()) &&
258 ++ is_vertex(m_vertices.prev_vertex(&x2, &y2)))
259 ++ {
260 ++ *x += x2;
261 ++ *y += y2;
262 ++ }
263 + }
264 + }
265 +
266 +--
267 +1.8.1.4
268 +
269
270 diff --git a/x11-libs/agg/files/2.5/0004-Make-rasterizer_outline_aa-ignore-close_polygon-when.patch b/x11-libs/agg/files/2.5/0004-Make-rasterizer_outline_aa-ignore-close_polygon-when.patch
271 new file mode 100644
272 index 00000000000..0cecaf79486
273 --- /dev/null
274 +++ b/x11-libs/agg/files/2.5/0004-Make-rasterizer_outline_aa-ignore-close_polygon-when.patch
275 @@ -0,0 +1,138 @@
276 +From b9c4b1c72b4ad6b24c37f402d3eec39ef393b0eb Mon Sep 17 00:00:00 2001
277 +From: Tom Hughes <tom@×××××××.nu>
278 +Date: Sun, 19 May 2013 14:17:43 +0100
279 +Subject: [PATCH 04/15] Make rasterizer_outline_aa ignore close_polygon when
280 + vertex count < 3
281 +
282 +---
283 + include/agg_rasterizer_outline_aa.h | 107 ++++++++++++++++++------------------
284 + 1 file changed, 52 insertions(+), 55 deletions(-)
285 +
286 +diff --git a/include/agg_rasterizer_outline_aa.h b/include/agg_rasterizer_outline_aa.h
287 +index 4d6dd57..24301d5 100644
288 +--- a/include/agg_rasterizer_outline_aa.h
289 ++++ b/include/agg_rasterizer_outline_aa.h
290 +@@ -333,68 +333,65 @@ namespace agg
291 + int y2;
292 + int lprev;
293 +
294 +- if(close_polygon)
295 ++ if(close_polygon && (m_src_vertices.size() >= 3))
296 + {
297 +- if(m_src_vertices.size() >= 3)
298 ++ dv.idx = 2;
299 ++
300 ++ v = &m_src_vertices[m_src_vertices.size() - 1];
301 ++ x1 = v->x;
302 ++ y1 = v->y;
303 ++ lprev = v->len;
304 ++
305 ++ v = &m_src_vertices[0];
306 ++ x2 = v->x;
307 ++ y2 = v->y;
308 ++ dv.lcurr = v->len;
309 ++ line_parameters prev(x1, y1, x2, y2, lprev);
310 ++
311 ++ v = &m_src_vertices[1];
312 ++ dv.x1 = v->x;
313 ++ dv.y1 = v->y;
314 ++ dv.lnext = v->len;
315 ++ dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
316 ++
317 ++ v = &m_src_vertices[dv.idx];
318 ++ dv.x2 = v->x;
319 ++ dv.y2 = v->y;
320 ++ dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
321 ++
322 ++ dv.xb1 = 0;
323 ++ dv.yb1 = 0;
324 ++ dv.xb2 = 0;
325 ++ dv.yb2 = 0;
326 ++
327 ++ switch(m_line_join)
328 + {
329 +- dv.idx = 2;
330 +-
331 +- v = &m_src_vertices[m_src_vertices.size() - 1];
332 +- x1 = v->x;
333 +- y1 = v->y;
334 +- lprev = v->len;
335 +-
336 +- v = &m_src_vertices[0];
337 +- x2 = v->x;
338 +- y2 = v->y;
339 +- dv.lcurr = v->len;
340 +- line_parameters prev(x1, y1, x2, y2, lprev);
341 +-
342 +- v = &m_src_vertices[1];
343 +- dv.x1 = v->x;
344 +- dv.y1 = v->y;
345 +- dv.lnext = v->len;
346 +- dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr);
347 +-
348 +- v = &m_src_vertices[dv.idx];
349 +- dv.x2 = v->x;
350 +- dv.y2 = v->y;
351 +- dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext);
352 +-
353 +- dv.xb1 = 0;
354 +- dv.yb1 = 0;
355 +- dv.xb2 = 0;
356 +- dv.yb2 = 0;
357 +-
358 +- switch(m_line_join)
359 +- {
360 +- case outline_no_join:
361 +- dv.flags = 3;
362 +- break;
363 ++ case outline_no_join:
364 ++ dv.flags = 3;
365 ++ break;
366 +
367 +- case outline_miter_join:
368 +- case outline_round_join:
369 +- dv.flags =
370 +- (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
371 +- ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
372 +- break;
373 ++ case outline_miter_join:
374 ++ case outline_round_join:
375 ++ dv.flags =
376 ++ (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) |
377 ++ ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1);
378 ++ break;
379 +
380 +- case outline_miter_accurate_join:
381 +- dv.flags = 0;
382 +- break;
383 +- }
384 ++ case outline_miter_accurate_join:
385 ++ dv.flags = 0;
386 ++ break;
387 ++ }
388 +
389 +- if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
390 +- {
391 +- bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
392 +- }
393 ++ if((dv.flags & 1) == 0 && m_line_join != outline_round_join)
394 ++ {
395 ++ bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1);
396 ++ }
397 +
398 +- if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
399 +- {
400 +- bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
401 +- }
402 +- draw(dv, 0, m_src_vertices.size());
403 ++ if((dv.flags & 2) == 0 && m_line_join != outline_round_join)
404 ++ {
405 ++ bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2);
406 + }
407 ++ draw(dv, 0, m_src_vertices.size());
408 + }
409 + else
410 + {
411 +--
412 +1.8.1.4
413 +
414
415 diff --git a/x11-libs/agg/files/2.5/0005-Remove-VC-6-workaround.patch b/x11-libs/agg/files/2.5/0005-Remove-VC-6-workaround.patch
416 new file mode 100644
417 index 00000000000..f38f7c40d0d
418 --- /dev/null
419 +++ b/x11-libs/agg/files/2.5/0005-Remove-VC-6-workaround.patch
420 @@ -0,0 +1,52 @@
421 +From b8c43fb0ba13af0cc2b1050f48f81d76d2fdf0c7 Mon Sep 17 00:00:00 2001
422 +From: Tom Hughes <tom@×××××××.nu>
423 +Date: Sun, 19 May 2013 15:04:05 +0100
424 +Subject: [PATCH 05/15] Remove VC++ 6 workaround
425 +
426 +---
427 + include/agg_renderer_scanline.h | 29 +----------------------------
428 + 1 file changed, 1 insertion(+), 28 deletions(-)
429 +
430 +diff --git a/include/agg_renderer_scanline.h b/include/agg_renderer_scanline.h
431 +index c3bb6f0..c27ca60 100644
432 +--- a/include/agg_renderer_scanline.h
433 ++++ b/include/agg_renderer_scanline.h
434 +@@ -79,34 +79,7 @@ namespace agg
435 + sl.reset(ras.min_x(), ras.max_x());
436 + while(ras.sweep_scanline(sl))
437 + {
438 +- //render_scanline_aa_solid(sl, ren, ren_color);
439 +-
440 +- // This code is equivalent to the above call (copy/paste).
441 +- // It's just a "manual" optimization for old compilers,
442 +- // like Microsoft Visual C++ v6.0
443 +- //-------------------------------
444 +- int y = sl.y();
445 +- unsigned num_spans = sl.num_spans();
446 +- typename Scanline::const_iterator span = sl.begin();
447 +-
448 +- for(;;)
449 +- {
450 +- int x = span->x;
451 +- if(span->len > 0)
452 +- {
453 +- ren.blend_solid_hspan(x, y, (unsigned)span->len,
454 +- ren_color,
455 +- span->covers);
456 +- }
457 +- else
458 +- {
459 +- ren.blend_hline(x, y, (unsigned)(x - span->len - 1),
460 +- ren_color,
461 +- *(span->covers));
462 +- }
463 +- if(--num_spans == 0) break;
464 +- ++span;
465 +- }
466 ++ render_scanline_aa_solid(sl, ren, ren_color);
467 + }
468 + }
469 + }
470 +--
471 +1.8.1.4
472 +
473
474 diff --git a/x11-libs/agg/files/2.5/0006-Implement-grain-merge-blending-mode-GIMP.patch b/x11-libs/agg/files/2.5/0006-Implement-grain-merge-blending-mode-GIMP.patch
475 new file mode 100644
476 index 00000000000..f1e465b4d3a
477 --- /dev/null
478 +++ b/x11-libs/agg/files/2.5/0006-Implement-grain-merge-blending-mode-GIMP.patch
479 @@ -0,0 +1,85 @@
480 +From 9422570f4e099a834fc43619f7b2a7eb6b442e25 Mon Sep 17 00:00:00 2001
481 +From: Tom Hughes <tom@×××××××.nu>
482 +Date: Sun, 19 May 2013 15:31:01 +0100
483 +Subject: [PATCH 06/15] Implement grain-merge blending mode (GIMP)
484 +
485 +---
486 + include/agg_pixfmt_rgba.h | 42 ++++++++++++++++++++++++++++++++++++++++--
487 + 1 file changed, 40 insertions(+), 2 deletions(-)
488 +
489 +diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
490 +index 79d10dc..f576ce4 100644
491 +--- a/include/agg_pixfmt_rgba.h
492 ++++ b/include/agg_pixfmt_rgba.h
493 +@@ -1401,9 +1401,46 @@ namespace agg
494 + }
495 + };
496 +
497 ++ //================================================comp_op_rgba_grain_merge
498 ++ template <typename ColorT, typename Order> struct comp_op_rgba_grain_merge
499 ++ {
500 ++ typedef ColorT color_type;
501 ++ typedef Order order_type;
502 ++ typedef typename color_type::value_type value_type;
503 ++ typedef typename color_type::calc_type calc_type;
504 ++ typedef typename color_type::long_type long_type;
505 ++ enum base_scale_e
506 ++ {
507 ++ base_shift = color_type::base_shift,
508 ++ base_mask = color_type::base_mask
509 ++ };
510 +
511 ++ // E = I + M - 128
512 ++ static AGG_INLINE void blend_pix(value_type* p,
513 ++ unsigned sr, unsigned sg, unsigned sb,
514 ++ unsigned sa, unsigned cover)
515 ++ {
516 +
517 +-
518 ++ if(cover < 255)
519 ++ {
520 ++ sr = (sr * cover + 255) >> 8;
521 ++ sg = (sg * cover + 255) >> 8;
522 ++ sb = (sb * cover + 255) >> 8;
523 ++ sa = (sa * cover + 255) >> 8;
524 ++ }
525 ++ if(sa)
526 ++ {
527 ++ calc_type da = p[Order::A];
528 ++ int dr = sr + p[Order::R] - 128;
529 ++ int dg = sg + p[Order::G] - 128;
530 ++ int db = sb + p[Order::B] - 128;
531 ++ p[Order::R] = (value_type)(dr < 0 ? 0 : (dr > 255 ? 255 : dr));
532 ++ p[Order::G] = (value_type)(dg < 0 ? 0 : (dg > 255 ? 255 : dg));
533 ++ p[Order::B] = (value_type)(db < 0 ? 0 : (db > 255 ? 255 : db));
534 ++ p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift));
535 ++ }
536 ++ }
537 ++ };
538 +
539 + //======================================================comp_op_table_rgba
540 + template<class ColorT, class Order> struct comp_op_table_rgba
541 +@@ -1451,6 +1488,7 @@ namespace agg
542 + comp_op_rgba_contrast <ColorT,Order>::blend_pix,
543 + comp_op_rgba_invert <ColorT,Order>::blend_pix,
544 + comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
545 ++ comp_op_rgba_grain_merge<ColorT,Order>::blend_pix,
546 + 0
547 + };
548 +
549 +@@ -1486,6 +1524,7 @@ namespace agg
550 + comp_op_contrast, //----comp_op_contrast
551 + comp_op_invert, //----comp_op_invert
552 + comp_op_invert_rgb, //----comp_op_invert_rgb
553 ++ comp_op_grain_merge, //----comp_op_grain_merge
554 +
555 + end_of_comp_op_e
556 + };
557 +@@ -2908,4 +2947,3 @@ namespace agg
558 + }
559 +
560 + #endif
561 +-
562 +--
563 +1.8.1.4
564 +
565
566 diff --git a/x11-libs/agg/files/2.5/0007-Implement-grain-extract-blending-mode-GIMP.patch b/x11-libs/agg/files/2.5/0007-Implement-grain-extract-blending-mode-GIMP.patch
567 new file mode 100644
568 index 00000000000..cafb36eb032
569 --- /dev/null
570 +++ b/x11-libs/agg/files/2.5/0007-Implement-grain-extract-blending-mode-GIMP.patch
571 @@ -0,0 +1,85 @@
572 +From abd440342e166a90d08610bf5b31d2a8357eafbe Mon Sep 17 00:00:00 2001
573 +From: Tom Hughes <tom@×××××××.nu>
574 +Date: Sun, 19 May 2013 15:43:18 +0100
575 +Subject: [PATCH 07/15] Implement grain-extract blending mode (GIMP)
576 +
577 +---
578 + include/agg_pixfmt_rgba.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++
579 + 1 file changed, 48 insertions(+)
580 +
581 +diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
582 +index f576ce4..42f0a05 100644
583 +--- a/include/agg_pixfmt_rgba.h
584 ++++ b/include/agg_pixfmt_rgba.h
585 +@@ -1442,6 +1442,52 @@ namespace agg
586 + }
587 + };
588 +
589 ++ //==============================================comp_op_rgba_grain_extract
590 ++ template <typename ColorT, typename Order> struct comp_op_rgba_grain_extract
591 ++ {
592 ++ typedef ColorT color_type;
593 ++ typedef Order order_type;
594 ++ typedef typename color_type::value_type value_type;
595 ++ typedef typename color_type::calc_type calc_type;
596 ++ typedef typename color_type::long_type long_type;
597 ++ enum base_scale_e
598 ++ {
599 ++ base_shift = color_type::base_shift,
600 ++ base_mask = color_type::base_mask
601 ++ };
602 ++
603 ++ // E = I - M + 128
604 ++ static AGG_INLINE void blend_pix(value_type* p,
605 ++ unsigned sr, unsigned sg, unsigned sb,
606 ++ unsigned sa, unsigned cover)
607 ++ {
608 ++ calc_type da = (p[Order::A] * sa + 255) >> 8;
609 ++
610 ++ int dr = p[Order::R] - sr + 128;
611 ++ int dg = p[Order::G] - sg + 128;
612 ++ int db = p[Order::B] - sb + 128;
613 ++
614 ++ dr = dr < 0 ? 0 : (dr > 255 ? 255 : dr);
615 ++ dg = dg < 0 ? 0 : (dg > 255 ? 255 : dg);
616 ++ db = db < 0 ? 0 : (db > 255 ? 255 : db);
617 ++
618 ++ p[Order::A] = da;
619 ++
620 ++ if(da < 255)
621 ++ {
622 ++ p[Order::R] = (dr * da + 255) >> 8;
623 ++ p[Order::G] = (dg * da + 255) >> 8;
624 ++ p[Order::B] = (db * da + 255) >> 8;
625 ++ }
626 ++ else
627 ++ {
628 ++ p[Order::R] = dr;
629 ++ p[Order::G] = dg;
630 ++ p[Order::B] = db;
631 ++ }
632 ++ }
633 ++ };
634 ++
635 + //======================================================comp_op_table_rgba
636 + template<class ColorT, class Order> struct comp_op_table_rgba
637 + {
638 +@@ -1489,6 +1535,7 @@ namespace agg
639 + comp_op_rgba_invert <ColorT,Order>::blend_pix,
640 + comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
641 + comp_op_rgba_grain_merge<ColorT,Order>::blend_pix,
642 ++ comp_op_rgba_grain_extract<ColorT,Order>::blend_pix,
643 + 0
644 + };
645 +
646 +@@ -1525,6 +1572,7 @@ namespace agg
647 + comp_op_invert, //----comp_op_invert
648 + comp_op_invert_rgb, //----comp_op_invert_rgb
649 + comp_op_grain_merge, //----comp_op_grain_merge
650 ++ comp_op_grain_extract, //----comp_op_grain_extract
651 +
652 + end_of_comp_op_e
653 + };
654 +--
655 +1.8.1.4
656 +
657
658 diff --git a/x11-libs/agg/files/2.5/0008-Declare-multiplication-and-division-operators-as-con.patch b/x11-libs/agg/files/2.5/0008-Declare-multiplication-and-division-operators-as-con.patch
659 new file mode 100644
660 index 00000000000..0ed92ee6cf9
661 --- /dev/null
662 +++ b/x11-libs/agg/files/2.5/0008-Declare-multiplication-and-division-operators-as-con.patch
663 @@ -0,0 +1,36 @@
664 +From 2688af280836b95908d3cfd6915510d55de673b8 Mon Sep 17 00:00:00 2001
665 +From: Tom Hughes <tom@×××××××.nu>
666 +Date: Sun, 19 May 2013 16:15:01 +0100
667 +Subject: [PATCH 08/15] Declare multiplication and division operators as const
668 +
669 +---
670 + include/agg_trans_affine.h | 8 ++++----
671 + 1 file changed, 4 insertions(+), 4 deletions(-)
672 +
673 +diff --git a/include/agg_trans_affine.h b/include/agg_trans_affine.h
674 +index a662099..2f602a0 100644
675 +--- a/include/agg_trans_affine.h
676 ++++ b/include/agg_trans_affine.h
677 +@@ -216,15 +216,15 @@ namespace agg
678 + }
679 +
680 + // Multiply the matrix by another one and return
681 +- // the result in a separete matrix.
682 +- trans_affine operator * (const trans_affine& m)
683 ++ // the result in a separate matrix.
684 ++ trans_affine operator * (const trans_affine& m) const
685 + {
686 + return trans_affine(*this).multiply(m);
687 + }
688 +
689 + // Multiply the matrix by inverse of another one
690 +- // and return the result in a separete matrix.
691 +- trans_affine operator / (const trans_affine& m)
692 ++ // and return the result in a separate matrix.
693 ++ trans_affine operator / (const trans_affine& m) const
694 + {
695 + return trans_affine(*this).multiply_inv(m);
696 + }
697 +--
698 +1.8.1.4
699 +
700
701 diff --git a/x11-libs/agg/files/2.5/0009-Add-a-static-identity-transformation.patch b/x11-libs/agg/files/2.5/0009-Add-a-static-identity-transformation.patch
702 new file mode 100644
703 index 00000000000..01555cb3afd
704 --- /dev/null
705 +++ b/x11-libs/agg/files/2.5/0009-Add-a-static-identity-transformation.patch
706 @@ -0,0 +1,37 @@
707 +From be9ed90897bc43b4547a3a1f8046827caaf13b4c Mon Sep 17 00:00:00 2001
708 +From: Tom Hughes <tom@×××××××.nu>
709 +Date: Sun, 19 May 2013 16:15:36 +0100
710 +Subject: [PATCH 09/15] Add a static identity transformation
711 +
712 +---
713 + include/agg_trans_affine.h | 1 +
714 + src/agg_trans_affine.cpp | 1 +
715 + 2 files changed, 2 insertions(+)
716 +
717 +diff --git a/include/agg_trans_affine.h b/include/agg_trans_affine.h
718 +index 2f602a0..67fe5ca 100644
719 +--- a/include/agg_trans_affine.h
720 ++++ b/include/agg_trans_affine.h
721 +@@ -92,6 +92,7 @@ namespace agg
722 + //----------------------------------------------------------------------
723 + struct trans_affine
724 + {
725 ++ static const trans_affine identity;
726 + double sx, shy, shx, sy, tx, ty;
727 +
728 + //------------------------------------------ Construction
729 +diff --git a/src/agg_trans_affine.cpp b/src/agg_trans_affine.cpp
730 +index aca18c2..b3d9bc0 100644
731 +--- a/src/agg_trans_affine.cpp
732 ++++ b/src/agg_trans_affine.cpp
733 +@@ -28,6 +28,7 @@
734 +
735 + namespace agg
736 + {
737 ++ const trans_affine trans_affine::identity;
738 +
739 + //------------------------------------------------------------------------
740 + const trans_affine& trans_affine::parl_to_parl(const double* src,
741 +--
742 +1.8.1.4
743 +
744
745 diff --git a/x11-libs/agg/files/2.5/0010-Add-renderer_scanline_aa_alpha.patch b/x11-libs/agg/files/2.5/0010-Add-renderer_scanline_aa_alpha.patch
746 new file mode 100644
747 index 00000000000..b0be2583fce
748 --- /dev/null
749 +++ b/x11-libs/agg/files/2.5/0010-Add-renderer_scanline_aa_alpha.patch
750 @@ -0,0 +1,193 @@
751 +From 749c8cd11e9e6f81e93ae5ce19258431722b6bdf Mon Sep 17 00:00:00 2001
752 +From: Tom Hughes <tom@×××××××.nu>
753 +Date: Sun, 19 May 2013 16:43:25 +0100
754 +Subject: [PATCH 10/15] Add renderer_scanline_aa_alpha
755 +
756 +---
757 + include/agg_pixfmt_rgba.h | 24 +++++++++++++-
758 + include/agg_renderer_base.h | 28 ++++++++++++++++
759 + include/agg_renderer_scanline.h | 71 +++++++++++++++++++++++++++++++++++++++++
760 + 3 files changed, 122 insertions(+), 1 deletion(-)
761 +
762 +diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
763 +index 42f0a05..6c4bc37 100644
764 +--- a/include/agg_pixfmt_rgba.h
765 ++++ b/include/agg_pixfmt_rgba.h
766 +@@ -2247,7 +2247,6 @@ namespace agg
767 + }
768 +
769 +
770 +-
771 + //--------------------------------------------------------------------
772 + void blend_color_vspan(int x, int y,
773 + unsigned len,
774 +@@ -2751,6 +2750,29 @@ namespace agg
775 + }
776 +
777 + //--------------------------------------------------------------------
778 ++ void blend_color_hspan_alpha(int x, int y, unsigned len,
779 ++ const color_type* colors,
780 ++ value_type alpha,
781 ++ const int8u* covers,
782 ++ int8u cover)
783 ++ {
784 ++ value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + (x << 2);
785 ++ do
786 ++ {
787 ++ blender_type::blend_pix(m_comp_op,
788 ++ p,
789 ++ (colors->r * alpha + 255) >> 8,
790 ++ (colors->g * alpha + 255) >> 8,
791 ++ (colors->b * alpha + 255) >> 8,
792 ++ (colors->a * alpha + 255) >> 8,
793 ++ covers ? *covers++ : cover);
794 ++ p += 4;
795 ++ ++colors;
796 ++ }
797 ++ while(--len);
798 ++ }
799 ++
800 ++ //--------------------------------------------------------------------
801 + void blend_color_vspan(int x, int y, unsigned len,
802 + const color_type* colors,
803 + const int8u* covers,
804 +diff --git a/include/agg_renderer_base.h b/include/agg_renderer_base.h
805 +index 1808944..25f07c3 100644
806 +--- a/include/agg_renderer_base.h
807 ++++ b/include/agg_renderer_base.h
808 +@@ -37,6 +37,7 @@ namespace agg
809 + public:
810 + typedef PixelFormat pixfmt_type;
811 + typedef typename pixfmt_type::color_type color_type;
812 ++ typedef typename pixfmt_type::color_type::value_type value_type;
813 + typedef typename pixfmt_type::row_data row_data;
814 +
815 + //--------------------------------------------------------------------
816 +@@ -383,6 +384,33 @@ namespace agg
817 + }
818 +
819 + //--------------------------------------------------------------------
820 ++ void blend_color_hspan_alpha(int x, int y, int len,
821 ++ const color_type* colors,
822 ++ value_type alpha,
823 ++ const cover_type* covers,
824 ++ cover_type cover = agg::cover_full)
825 ++ {
826 ++ if(y > ymax()) return;
827 ++ if(y < ymin()) return;
828 ++
829 ++ if(x < xmin())
830 ++ {
831 ++ int d = xmin() - x;
832 ++ len -= d;
833 ++ if(len <= 0) return;
834 ++ if(covers) covers += d;
835 ++ colors += d;
836 ++ x = xmin();
837 ++ }
838 ++ if(x + len > xmax())
839 ++ {
840 ++ len = xmax() - x + 1;
841 ++ if(len <= 0) return;
842 ++ }
843 ++ m_ren->blend_color_hspan_alpha(x, y, len, colors, alpha, covers, cover);
844 ++ }
845 ++
846 ++ //--------------------------------------------------------------------
847 + void blend_color_vspan(int x, int y, int len,
848 + const color_type* colors,
849 + const cover_type* covers,
850 +diff --git a/include/agg_renderer_scanline.h b/include/agg_renderer_scanline.h
851 +index c27ca60..4fcb557 100644
852 +--- a/include/agg_renderer_scanline.h
853 ++++ b/include/agg_renderer_scanline.h
854 +@@ -156,6 +156,35 @@ namespace agg
855 + }
856 + }
857 +
858 ++ //================================================render_scanline_aa_alpha
859 ++ template<class Scanline, class BaseRenderer,
860 ++ class SpanAllocator, class SpanGenerator>
861 ++ void render_scanline_aa_alpha(const Scanline& sl, BaseRenderer& ren,
862 ++ SpanAllocator& alloc, SpanGenerator& span_gen,
863 ++ unsigned alpha)
864 ++ {
865 ++ int y = sl.y();
866 ++
867 ++ unsigned num_spans = sl.num_spans();
868 ++ typename Scanline::const_iterator span = sl.begin();
869 ++ for(;;)
870 ++ {
871 ++ int x = span->x;
872 ++ int len = span->len;
873 ++ const typename Scanline::cover_type* covers = span->covers;
874 ++
875 ++ if(len < 0) len = -len;
876 ++ typename BaseRenderer::color_type* colors = alloc.allocate(len);
877 ++ span_gen.generate(colors, x, y, len);
878 ++ ren.blend_color_hspan_alpha(x, y, len, colors, alpha,
879 ++ (span->len < 0) ? 0 : covers, *covers);
880 ++
881 ++ if(--num_spans == 0) break;
882 ++ ++span;
883 ++ }
884 ++ }
885 ++
886 ++
887 + //=====================================================render_scanlines_aa
888 + template<class Rasterizer, class Scanline, class BaseRenderer,
889 + class SpanAllocator, class SpanGenerator>
890 +@@ -216,8 +245,50 @@ namespace agg
891 + };
892 +
893 +
894 ++ //==============================================renderer_scanline_aa_alpha
895 ++ template<class BaseRenderer, class SpanAllocator, class SpanGenerator>
896 ++ class renderer_scanline_aa_alpha
897 ++ {
898 ++ public:
899 ++ typedef BaseRenderer base_ren_type;
900 ++ typedef SpanAllocator alloc_type;
901 ++ typedef SpanGenerator span_gen_type;
902 +
903 ++ //--------------------------------------------------------------------
904 ++ renderer_scanline_aa_alpha() : m_ren(0), m_alloc(0), m_span_gen(0), m_alpha(1.0) {}
905 ++ renderer_scanline_aa_alpha(base_ren_type& ren,
906 ++ alloc_type& alloc,
907 ++ span_gen_type& span_gen,
908 ++ unsigned alpha) :
909 ++ m_ren(&ren),
910 ++ m_alloc(&alloc),
911 ++ m_span_gen(&span_gen),
912 ++ m_alpha(alpha)
913 ++ {}
914 ++ void attach(base_ren_type& ren,
915 ++ alloc_type& alloc,
916 ++ span_gen_type& span_gen)
917 ++ {
918 ++ m_ren = &ren;
919 ++ m_alloc = &alloc;
920 ++ m_span_gen = &span_gen;
921 ++ }
922 +
923 ++ //--------------------------------------------------------------------
924 ++ void prepare() { m_span_gen->prepare(); }
925 ++
926 ++ //--------------------------------------------------------------------
927 ++ template<class Scanline> void render(const Scanline& sl)
928 ++ {
929 ++ render_scanline_aa_alpha(sl, *m_ren, *m_alloc, *m_span_gen, m_alpha);
930 ++ }
931 ++
932 ++ private:
933 ++ base_ren_type* m_ren;
934 ++ alloc_type* m_alloc;
935 ++ span_gen_type* m_span_gen;
936 ++ unsigned m_alpha;
937 ++ };
938 +
939 +
940 + //===============================================render_scanline_bin_solid
941 +--
942 +1.8.1.4
943 +
944
945 diff --git a/x11-libs/agg/files/2.5/0011-Avoid-division-by-zero-in-color-burn-mode.patch b/x11-libs/agg/files/2.5/0011-Avoid-division-by-zero-in-color-burn-mode.patch
946 new file mode 100644
947 index 00000000000..2a0d198fe91
948 --- /dev/null
949 +++ b/x11-libs/agg/files/2.5/0011-Avoid-division-by-zero-in-color-burn-mode.patch
950 @@ -0,0 +1,58 @@
951 +From 0ec68d7f5695403eccac75025ba7f6f7ecf1814e Mon Sep 17 00:00:00 2001
952 +From: Tom Hughes <tom@×××××××.nu>
953 +Date: Sun, 19 May 2013 16:49:08 +0100
954 +Subject: [PATCH 11/15] Avoid division by zero in color-burn mode
955 +
956 +FIXME: re-work using latest math from http://www.w3.org/TR/SVGCompositing/
957 +---
958 + include/agg_pixfmt_rgba.h | 21 ++++++++++++++++++---
959 + 1 file changed, 18 insertions(+), 3 deletions(-)
960 +
961 +diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
962 +index 6c4bc37..5d6b511 100644
963 +--- a/include/agg_pixfmt_rgba.h
964 ++++ b/include/agg_pixfmt_rgba.h
965 +@@ -1027,6 +1027,21 @@ namespace agg
966 + // Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa)
967 + //
968 + // Da' = Sa + Da - Sa.Da
969 ++
970 ++
971 ++ // http://www.w3.org/TR/SVGCompositing/
972 ++ // if Sca == 0 and Dca == Da
973 ++ // Dca' = Sa × Da + Sca × (1 - Da) + Dca × (1 - Sa)
974 ++ // = Sa × Da + Dca × (1 - Sa)
975 ++ // = Da = Dca
976 ++ // otherwise if Sca == 0
977 ++ // Dca' = Sca × (1 - Da) + Dca × (1 - Sa)
978 ++ // = Dca × (1 - Sa)
979 ++ // otherwise if Sca > 0
980 ++ // Dca' = Sa × Da - Sa × Da × min(1, (1 - Dca/Da) × Sa/Sca) + Sca × (1 - Da) + Dca × (1 - Sa)
981 ++ // = Sa × Da × (1 - min(1, (1 - Dca/Da) × Sa/Sca)) + Sca × (1 - Da) + Dca × (1 - Sa)
982 ++
983 ++ // sa * da * (255 - std::min(255, (255 - p[0]/da)*(sa/(sc*sa)) +
984 + static AGG_INLINE void blend_pix(value_type* p,
985 + unsigned sr, unsigned sg, unsigned sb,
986 + unsigned sa, unsigned cover)
987 +@@ -1056,15 +1071,15 @@ namespace agg
988 +
989 + p[Order::R] = (value_type)(((srda + drsa <= sada) ?
990 + sr * d1a + dr * s1a :
991 +- sa * (srda + drsa - sada) / sr + sr * d1a + dr * s1a + base_mask) >> base_shift);
992 ++ (sr > 0 ? sa * (srda + drsa - sada) / sr + sr * d1a + dr * s1a + base_mask : 0)) >> base_shift);
993 +
994 + p[Order::G] = (value_type)(((sgda + dgsa <= sada) ?
995 + sg * d1a + dg * s1a :
996 +- sa * (sgda + dgsa - sada) / sg + sg * d1a + dg * s1a + base_mask) >> base_shift);
997 ++ (sg > 0 ? sa * (sgda + dgsa - sada) / sg + sg * d1a + dg * s1a + base_mask : 0)) >> base_shift);
998 +
999 + p[Order::B] = (value_type)(((sbda + dbsa <= sada) ?
1000 + sb * d1a + db * s1a :
1001 +- sa * (sbda + dbsa - sada) / sb + sb * d1a + db * s1a + base_mask) >> base_shift);
1002 ++ (sb > 0 ? sa * (sbda + dbsa - sada) / sb + sb * d1a + db * s1a + base_mask : 0)) >> base_shift);
1003 +
1004 + p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift));
1005 + }
1006 +--
1007 +1.8.1.4
1008 +
1009
1010 diff --git a/x11-libs/agg/files/2.5/0012-Avoid-pixel-artifacts-when-compositing.patch b/x11-libs/agg/files/2.5/0012-Avoid-pixel-artifacts-when-compositing.patch
1011 new file mode 100644
1012 index 00000000000..b3e641e6f53
1013 --- /dev/null
1014 +++ b/x11-libs/agg/files/2.5/0012-Avoid-pixel-artifacts-when-compositing.patch
1015 @@ -0,0 +1,26 @@
1016 +From bf0e0b71360cfbc690a29f4abe15d7b9b61b8479 Mon Sep 17 00:00:00 2001
1017 +From: Tom Hughes <tom@×××××××.nu>
1018 +Date: Sat, 22 Jun 2013 12:11:54 +0100
1019 +Subject: [PATCH 12/15] Avoid pixel artifacts when compositing
1020 +
1021 +Change src_over alpha to avoid pixel artifacts by reordering computations.
1022 +---
1023 + include/agg_pixfmt_rgba.h | 2 +-
1024 + 1 file changed, 1 insertion(+), 1 deletion(-)
1025 +
1026 +diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
1027 +index 5d6b511..bb255cd 100644
1028 +--- a/include/agg_pixfmt_rgba.h
1029 ++++ b/include/agg_pixfmt_rgba.h
1030 +@@ -346,7 +346,7 @@ namespace agg
1031 + p[Order::R] = (value_type)(sr + ((p[Order::R] * s1a + base_mask) >> base_shift));
1032 + p[Order::G] = (value_type)(sg + ((p[Order::G] * s1a + base_mask) >> base_shift));
1033 + p[Order::B] = (value_type)(sb + ((p[Order::B] * s1a + base_mask) >> base_shift));
1034 +- p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift));
1035 ++ p[Order::A] = (value_type)(sa + ((p[Order::A] * s1a + base_mask) >> base_shift));
1036 + }
1037 + };
1038 +
1039 +--
1040 +1.8.1.4
1041 +
1042
1043 diff --git a/x11-libs/agg/files/2.5/0013-Modify-agg-conv-classes-to-allow-access-to-the-origi.patch b/x11-libs/agg/files/2.5/0013-Modify-agg-conv-classes-to-allow-access-to-the-origi.patch
1044 new file mode 100644
1045 index 00000000000..9deb9047342
1046 --- /dev/null
1047 +++ b/x11-libs/agg/files/2.5/0013-Modify-agg-conv-classes-to-allow-access-to-the-origi.patch
1048 @@ -0,0 +1,93 @@
1049 +From 6f1ab5f4b470bcf4e7e72aac6e2f7f6ee3e7b424 Mon Sep 17 00:00:00 2001
1050 +From: Tom Hughes <tom@×××××××.nu>
1051 +Date: Sat, 22 Jun 2013 12:16:42 +0100
1052 +Subject: [PATCH 13/15] Modify agg conv classes to allow access to the original
1053 + geometry type
1054 +
1055 +---
1056 + include/agg_conv_adaptor_vcgen.h | 2 ++
1057 + include/agg_conv_adaptor_vpgen.h | 1 +
1058 + include/agg_conv_clip_polygon.h | 1 +
1059 + include/agg_conv_clip_polyline.h | 1 +
1060 + include/agg_conv_smooth_poly1.h | 2 ++
1061 + 5 files changed, 7 insertions(+)
1062 +
1063 +diff --git a/include/agg_conv_adaptor_vcgen.h b/include/agg_conv_adaptor_vcgen.h
1064 +index 7bd9b07..fef4579 100644
1065 +--- a/include/agg_conv_adaptor_vcgen.h
1066 ++++ b/include/agg_conv_adaptor_vcgen.h
1067 +@@ -38,6 +38,7 @@ namespace agg
1068 +
1069 + void rewind(unsigned) {}
1070 + unsigned vertex(double*, double*) { return path_cmd_stop; }
1071 ++ unsigned type() const { return 0; }
1072 + };
1073 +
1074 +
1075 +@@ -73,6 +74,7 @@ namespace agg
1076 + }
1077 +
1078 + unsigned vertex(double* x, double* y);
1079 ++ unsigned type() const { return m_source->type(); }
1080 +
1081 + private:
1082 + // Prohibit copying
1083 +diff --git a/include/agg_conv_adaptor_vpgen.h b/include/agg_conv_adaptor_vpgen.h
1084 +index dca9415..a39102d 100644
1085 +--- a/include/agg_conv_adaptor_vpgen.h
1086 ++++ b/include/agg_conv_adaptor_vpgen.h
1087 +@@ -42,6 +42,7 @@ namespace agg
1088 +
1089 + void rewind(unsigned path_id);
1090 + unsigned vertex(double* x, double* y);
1091 ++ unsigned type() const { return m_source->type(); }
1092 +
1093 + private:
1094 + conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
1095 +diff --git a/include/agg_conv_clip_polygon.h b/include/agg_conv_clip_polygon.h
1096 +index 3c34590..e417a7d 100644
1097 +--- a/include/agg_conv_clip_polygon.h
1098 ++++ b/include/agg_conv_clip_polygon.h
1099 +@@ -60,6 +60,7 @@ namespace agg
1100 + double y1() const { return base_type::vpgen().y1(); }
1101 + double x2() const { return base_type::vpgen().x2(); }
1102 + double y2() const { return base_type::vpgen().y2(); }
1103 ++ unsigned type() const { return base_type::type(); }
1104 +
1105 + private:
1106 + conv_clip_polygon(const conv_clip_polygon<VertexSource>&);
1107 +diff --git a/include/agg_conv_clip_polyline.h b/include/agg_conv_clip_polyline.h
1108 +index d45067f..0de4b57 100644
1109 +--- a/include/agg_conv_clip_polyline.h
1110 ++++ b/include/agg_conv_clip_polyline.h
1111 +@@ -60,6 +60,7 @@ namespace agg
1112 + double y1() const { return base_type::vpgen().y1(); }
1113 + double x2() const { return base_type::vpgen().x2(); }
1114 + double y2() const { return base_type::vpgen().y2(); }
1115 ++ unsigned type() const { return base_type::type(); }
1116 +
1117 + private:
1118 + conv_clip_polyline(const conv_clip_polyline<VertexSource>&);
1119 +diff --git a/include/agg_conv_smooth_poly1.h b/include/agg_conv_smooth_poly1.h
1120 +index 15f7f8d..0956c4e 100644
1121 +--- a/include/agg_conv_smooth_poly1.h
1122 ++++ b/include/agg_conv_smooth_poly1.h
1123 +@@ -48,6 +48,7 @@ namespace agg
1124 +
1125 + void smooth_value(double v) { base_type::generator().smooth_value(v); }
1126 + double smooth_value() const { return base_type::generator().smooth_value(); }
1127 ++ unsigned type() const { return base_type::type(); }
1128 +
1129 + private:
1130 + conv_smooth_poly1(const conv_smooth_poly1<VertexSource>&);
1131 +@@ -70,6 +71,7 @@ namespace agg
1132 +
1133 + void smooth_value(double v) { m_smooth.generator().smooth_value(v); }
1134 + double smooth_value() const { return m_smooth.generator().smooth_value(); }
1135 ++ unsigned type() const { return m_smooth.type(); }
1136 +
1137 + private:
1138 + conv_smooth_poly1_curve(const conv_smooth_poly1_curve<VertexSource>&);
1139 +--
1140 +1.8.1.4
1141 +
1142
1143 diff --git a/x11-libs/agg/files/2.5/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch b/x11-libs/agg/files/2.5/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
1144 new file mode 100644
1145 index 00000000000..547b0d21886
1146 --- /dev/null
1147 +++ b/x11-libs/agg/files/2.5/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
1148 @@ -0,0 +1,30 @@
1149 +From 6433a64f4cd41e88499386b0b7c7ae05d30683b8 Mon Sep 17 00:00:00 2001
1150 +From: Tom Hughes <tom@×××××××.nu>
1151 +Date: Sat, 22 Jun 2013 12:33:32 +0100
1152 +Subject: [PATCH 14/15] Avoid potential zero division resulting in nan in
1153 + agg::gamma_linear
1154 +
1155 +---
1156 + include/agg_gamma_functions.h | 6 +++++-
1157 + 1 file changed, 5 insertions(+), 1 deletion(-)
1158 +
1159 +diff --git a/include/agg_gamma_functions.h b/include/agg_gamma_functions.h
1160 +index fa38a45..beb0c04 100644
1161 +--- a/include/agg_gamma_functions.h
1162 ++++ b/include/agg_gamma_functions.h
1163 +@@ -94,7 +94,11 @@ namespace agg
1164 + {
1165 + if(x < m_start) return 0.0;
1166 + if(x > m_end) return 1.0;
1167 +- return (x - m_start) / (m_end - m_start);
1168 ++ double delta = m_end - m_start;
1169 ++ // avoid nan from potential zero division
1170 ++ // https://github.com/mapnik/mapnik/issues/761
1171 ++ if (delta <= 0.0) return 0.0;
1172 ++ return (x - m_start) / delta;
1173 + }
1174 +
1175 + private:
1176 +--
1177 +1.8.1.4
1178 +
1179
1180 diff --git a/x11-libs/agg/files/2.5/0015-Ensure-first-value-in-the-gamma-table-is-always-zero.patch b/x11-libs/agg/files/2.5/0015-Ensure-first-value-in-the-gamma-table-is-always-zero.patch
1181 new file mode 100644
1182 index 00000000000..6214bd62e3a
1183 --- /dev/null
1184 +++ b/x11-libs/agg/files/2.5/0015-Ensure-first-value-in-the-gamma-table-is-always-zero.patch
1185 @@ -0,0 +1,24 @@
1186 +From ca818d4dcd428c5560fc3c341fbaf427a7485e32 Mon Sep 17 00:00:00 2001
1187 +From: Tom Hughes <tom@×××××××.nu>
1188 +Date: Sat, 22 Jun 2013 12:34:37 +0100
1189 +Subject: [PATCH 15/15] Ensure first value in the gamma table is always zero
1190 +
1191 +---
1192 + include/agg_gamma_functions.h | 1 +
1193 + 1 file changed, 1 insertion(+)
1194 +
1195 +diff --git a/include/agg_gamma_functions.h b/include/agg_gamma_functions.h
1196 +index beb0c04..b8eda52 100644
1197 +--- a/include/agg_gamma_functions.h
1198 ++++ b/include/agg_gamma_functions.h
1199 +@@ -49,6 +49,7 @@ namespace agg
1200 +
1201 + double operator() (double x) const
1202 + {
1203 ++ if (x == 0.0) return 0.0;
1204 + return pow(x, m_gamma);
1205 + }
1206 +
1207 +--
1208 +1.8.1.4
1209 +
1210
1211 diff --git a/x11-libs/agg/files/agg-2.4-depends.patch b/x11-libs/agg/files/agg-2.4-depends.patch
1212 new file mode 100644
1213 index 00000000000..9d4f6e309d8
1214 --- /dev/null
1215 +++ b/x11-libs/agg/files/agg-2.4-depends.patch
1216 @@ -0,0 +1,48 @@
1217 +--- agg-2.4.orig/font_freetype/Makefile.am 2005-10-18 11:45:40.000000000 +0100
1218 ++++ agg-2.4/font_freetype/Makefile.am 2006-07-10 15:11:55.000000000 +0100
1219 +@@ -4,8 +4,9 @@
1220 + agginclude_HEADERS = agg_font_freetype.h
1221 + lib_LTLIBRARIES = libaggfontfreetype.la
1222 +
1223 +-libaggfontfreetype_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ @FREETYPE_LIBS@
1224 ++libaggfontfreetype_la_LDFLAGS = -version-info @AGG_LIB_VERSION@
1225 + libaggfontfreetype_la_SOURCES = agg_font_freetype.cpp
1226 + libaggfontfreetype_la_CXXFLAGS = -I$(top_srcdir)/include @FREETYPE_CFLAGS@
1227 ++libaggfontfreetype_la_LIBADD = ../src/libagg.la @FREETYPE_LIBS@
1228 + endif
1229 +
1230 +--- agg-2.4.orig/src/platform/sdl/Makefile.am 2005-10-17 23:49:35.000000000 +0100
1231 ++++ agg-2.4/src/platform/sdl/Makefile.am 2006-07-10 15:11:55.000000000 +0100
1232 +@@ -5,6 +5,6 @@
1233 + libaggplatformsdl_la_LDFLAGS = -version-info @AGG_LIB_VERSION@
1234 + libaggplatformsdl_la_SOURCES = agg_platform_support.cpp
1235 + libaggplatformsdl_la_CXXFLAGS = -I$(top_srcdir)/include @SDL_CFLAGS@
1236 +-libaggplatformsdl_la_LIBADD = @SDL_LIBS@
1237 ++libaggplatformsdl_la_LIBADD = ../../libagg.la @SDL_LIBS@
1238 + endif
1239 +
1240 +--- agg-2.5.orig/configure.in 2006-10-09 05:06:36.000000000 +0100
1241 ++++ agg-2.5/configure.in 2007-01-07 14:07:39.000000000 +0000
1242 +@@ -122,7 +122,8 @@
1243 + fi
1244 + AM_CONDITIONAL(ENABLE_X11,[test x$no_x = x -a xno != x$enable_platform -a x$win32_host != xyes])
1245 + AC_SUBST(x_includes)
1246 +-AC_SUBST(x_libraries)
1247 ++test -n "$x_libraries" && X_LDFLAGS="-L$x_libraries"
1248 ++AC_SUBST(X_LDFLAGS)
1249 + dnl ###############################################
1250 +
1251 + dnl Settung up library version
1252 +--- agg-2.5.orig/src/platform/X11/Makefile.am 2006-12-11 00:59:45.000000000 +0000
1253 ++++ agg-2.5/src/platform/X11/Makefile.am 2007-01-07 14:07:39.000000000 +0000
1254 +@@ -1,8 +1,8 @@
1255 + if ENABLE_X11
1256 + lib_LTLIBRARIES = libaggplatformX11.la
1257 +
1258 +-libaggplatformX11_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ -L@x_libraries@
1259 ++libaggplatformX11_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ @X_LDFLAGS@
1260 + libaggplatformX11_la_SOURCES = agg_platform_support.cpp
1261 + libaggplatformX11_la_CXXFLAGS = -I$(top_srcdir)/include -I@x_includes@
1262 +-libaggplatformX11_la_LIBADD = -lX11
1263 ++libaggplatformX11_la_LIBADD = ../../libagg.la -lX11
1264 + endif
1265
1266 diff --git a/x11-libs/agg/files/agg-2.5-autotools.patch b/x11-libs/agg/files/agg-2.5-autotools.patch
1267 new file mode 100644
1268 index 00000000000..1272b65bb69
1269 --- /dev/null
1270 +++ b/x11-libs/agg/files/agg-2.5-autotools.patch
1271 @@ -0,0 +1,11 @@
1272 +--- a/configure.in 2013-02-22 09:30:00.000000000 -0600
1273 ++++ b/configure.in 2013-02-22 09:30:49.030777571 -0600
1274 +@@ -8,7 +8,7 @@
1275 + AC_PROG_CC
1276 + AC_PROG_CXX
1277 + AC_ISC_POSIX
1278 +-AM_C_PROTOTYPES
1279 ++#AM_C_PROTOTYPES
1280 + if test "x$U" != "x"; then
1281 + AC_MSG_ERROR(Compiler not ANSI compliant)
1282 + fi
1283
1284 diff --git a/x11-libs/agg/files/agg-2.5-pkgconfig.patch b/x11-libs/agg/files/agg-2.5-pkgconfig.patch
1285 new file mode 100644
1286 index 00000000000..a303bfb9050
1287 --- /dev/null
1288 +++ b/x11-libs/agg/files/agg-2.5-pkgconfig.patch
1289 @@ -0,0 +1,10 @@
1290 +--- agg-2.5/libagg.pc.in.orig 2007-01-07 13:58:28.000000000 +0000
1291 ++++ agg-2.5/libagg.pc.in 2007-01-07 14:02:40.000000000 +0000
1292 +@@ -6,5 +6,6 @@
1293 + Name: libagg
1294 + Description: Anti Grain Geometry - A High Quality Rendering Engine for C++
1295 + Version: @VERSION@
1296 +-Libs: -L${libdir} -Wl,-rpath,${exec_prefix}/lib -lagg
1297 ++Requires.private: freetype2
1298 ++Libs: -L${libdir} -lagg
1299 + Cflags: -I${includedir}
1300
1301 diff --git a/x11-libs/agg/files/agg-2.5-sdl-automagic.patch b/x11-libs/agg/files/agg-2.5-sdl-automagic.patch
1302 new file mode 100644
1303 index 00000000000..19daaea0673
1304 --- /dev/null
1305 +++ b/x11-libs/agg/files/agg-2.5-sdl-automagic.patch
1306 @@ -0,0 +1,26 @@
1307 +--- a/configure.in 2013-08-06 16:35:30.740061017 -0700
1308 ++++ b/configure.in 2013-08-06 16:40:47.511004499 -0700
1309 +@@ -95,10 +95,14 @@
1310 +
1311 + dnl ######### Check for SDL: #####################
1312 + dnl the sdl script pollutes our global values:
1313 ++AC_ARG_ENABLE(sdl,
1314 ++ AC_HELP_STRING([--enable-sdl],[enable the sdl layer]) )
1315 ++
1316 ++sdl_enabled="no"
1317 ++if test x"$enable_sdl" = x"yes"; then
1318 + temp_LIBS="$LIBS"
1319 + temp_CFLAGS="$CFLAGS"
1320 + temp_CXXFLAGS="$CXXFLAGS"
1321 +-sdl_enabled=""
1322 + SDL_VERSION=1.2.0
1323 + AM_PATH_SDL($SDL_VERSION,
1324 + [sdl_enabled="yes"],
1325 +@@ -111,6 +115,7 @@
1326 + dnl ### the sdl script already does that:
1327 + dnl AC_SUBST(SDL_CFLAGS)
1328 + dnl AC_SUBST(SDL_LIBS)
1329 ++fi
1330 + AM_CONDITIONAL(ENABLE_SDL,[test xyes = x$sdl_enabled -a xno != x$enable_platform -a x$win32_host != xyes])
1331 + dnl ###############################################
1332 +
1333
1334 diff --git a/x11-libs/agg/files/agg-2.5-sdl-m4.patch b/x11-libs/agg/files/agg-2.5-sdl-m4.patch
1335 new file mode 100644
1336 index 00000000000..2e2569f8b98
1337 --- /dev/null
1338 +++ b/x11-libs/agg/files/agg-2.5-sdl-m4.patch
1339 @@ -0,0 +1,186 @@
1340 +--- a/sdl.m4 1969-12-31 16:00:00.000000000 -0800
1341 ++++ b/sdl.m4 2008-01-24 07:50:20.000000000 -0800
1342 +@@ -0,0 +1,183 @@
1343 ++# Configure paths for SDL
1344 ++# Sam Lantinga 9/21/99
1345 ++# stolen from Manish Singh
1346 ++# stolen back from Frank Belew
1347 ++# stolen from Manish Singh
1348 ++# Shamelessly stolen from Owen Taylor
1349 ++
1350 ++dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1351 ++dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
1352 ++dnl
1353 ++AC_DEFUN([AM_PATH_SDL],
1354 ++[dnl
1355 ++dnl Get the cflags and libraries from the sdl-config script
1356 ++dnl
1357 ++AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
1358 ++ sdl_prefix="$withval", sdl_prefix="")
1359 ++AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
1360 ++ sdl_exec_prefix="$withval", sdl_exec_prefix="")
1361 ++AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
1362 ++ , enable_sdltest=yes)
1363 ++
1364 ++ if test x$sdl_exec_prefix != x ; then
1365 ++ sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
1366 ++ if test x${SDL_CONFIG+set} != xset ; then
1367 ++ SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
1368 ++ fi
1369 ++ fi
1370 ++ if test x$sdl_prefix != x ; then
1371 ++ sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
1372 ++ if test x${SDL_CONFIG+set} != xset ; then
1373 ++ SDL_CONFIG=$sdl_prefix/bin/sdl-config
1374 ++ fi
1375 ++ fi
1376 ++
1377 ++ as_save_PATH="$PATH"
1378 ++ if test "x$prefix" != xNONE; then
1379 ++ PATH="$prefix/bin:$prefix/usr/bin:$PATH"
1380 ++ fi
1381 ++ AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
1382 ++ PATH="$as_save_PATH"
1383 ++ min_sdl_version=ifelse([$1], ,0.11.0,$1)
1384 ++ AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
1385 ++ no_sdl=""
1386 ++ if test "$SDL_CONFIG" = "no" ; then
1387 ++ no_sdl=yes
1388 ++ else
1389 ++ SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
1390 ++ SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
1391 ++
1392 ++ sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
1393 ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1394 ++ sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
1395 ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1396 ++ sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
1397 ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1398 ++ if test "x$enable_sdltest" = "xyes" ; then
1399 ++ ac_save_CFLAGS="$CFLAGS"
1400 ++ ac_save_CXXFLAGS="$CXXFLAGS"
1401 ++ ac_save_LIBS="$LIBS"
1402 ++ CFLAGS="$CFLAGS $SDL_CFLAGS"
1403 ++ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1404 ++ LIBS="$LIBS $SDL_LIBS"
1405 ++dnl
1406 ++dnl Now check if the installed SDL is sufficiently new. (Also sanity
1407 ++dnl checks the results of sdl-config to some extent
1408 ++dnl
1409 ++ rm -f conf.sdltest
1410 ++ AC_TRY_RUN([
1411 ++#include <stdio.h>
1412 ++#include <stdlib.h>
1413 ++#include <string.h>
1414 ++#include "SDL.h"
1415 ++
1416 ++char*
1417 ++my_strdup (char *str)
1418 ++{
1419 ++ char *new_str;
1420 ++
1421 ++ if (str)
1422 ++ {
1423 ++ new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
1424 ++ strcpy (new_str, str);
1425 ++ }
1426 ++ else
1427 ++ new_str = NULL;
1428 ++
1429 ++ return new_str;
1430 ++}
1431 ++
1432 ++int main (int argc, char *argv[])
1433 ++{
1434 ++ int major, minor, micro;
1435 ++ char *tmp_version;
1436 ++
1437 ++ /* This hangs on some systems (?)
1438 ++ system ("touch conf.sdltest");
1439 ++ */
1440 ++ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
1441 ++
1442 ++ /* HP/UX 9 (%@#!) writes to sscanf strings */
1443 ++ tmp_version = my_strdup("$min_sdl_version");
1444 ++ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1445 ++ printf("%s, bad version string\n", "$min_sdl_version");
1446 ++ exit(1);
1447 ++ }
1448 ++
1449 ++ if (($sdl_major_version > major) ||
1450 ++ (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
1451 ++ (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
1452 ++ {
1453 ++ return 0;
1454 ++ }
1455 ++ else
1456 ++ {
1457 ++ printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
1458 ++ printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
1459 ++ printf("*** best to upgrade to the required version.\n");
1460 ++ printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
1461 ++ printf("*** to point to the correct copy of sdl-config, and remove the file\n");
1462 ++ printf("*** config.cache before re-running configure\n");
1463 ++ return 1;
1464 ++ }
1465 ++}
1466 ++
1467 ++],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1468 ++ CFLAGS="$ac_save_CFLAGS"
1469 ++ CXXFLAGS="$ac_save_CXXFLAGS"
1470 ++ LIBS="$ac_save_LIBS"
1471 ++ fi
1472 ++ fi
1473 ++ if test "x$no_sdl" = x ; then
1474 ++ AC_MSG_RESULT(yes)
1475 ++ ifelse([$2], , :, [$2])
1476 ++ else
1477 ++ AC_MSG_RESULT(no)
1478 ++ if test "$SDL_CONFIG" = "no" ; then
1479 ++ echo "*** The sdl-config script installed by SDL could not be found"
1480 ++ echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
1481 ++ echo "*** your path, or set the SDL_CONFIG environment variable to the"
1482 ++ echo "*** full path to sdl-config."
1483 ++ else
1484 ++ if test -f conf.sdltest ; then
1485 ++ :
1486 ++ else
1487 ++ echo "*** Could not run SDL test program, checking why..."
1488 ++ CFLAGS="$CFLAGS $SDL_CFLAGS"
1489 ++ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
1490 ++ LIBS="$LIBS $SDL_LIBS"
1491 ++ AC_TRY_LINK([
1492 ++#include <stdio.h>
1493 ++#include "SDL.h"
1494 ++
1495 ++int main(int argc, char *argv[])
1496 ++{ return 0; }
1497 ++#undef main
1498 ++#define main K_and_R_C_main
1499 ++], [ return 0; ],
1500 ++ [ echo "*** The test program compiled, but did not run. This usually means"
1501 ++ echo "*** that the run-time linker is not finding SDL or finding the wrong"
1502 ++ echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
1503 ++ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1504 ++ echo "*** to the installed location Also, make sure you have run ldconfig if that"
1505 ++ echo "*** is required on your system"
1506 ++ echo "***"
1507 ++ echo "*** If you have an old version installed, it is best to remove it, although"
1508 ++ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1509 ++ [ echo "*** The test program failed to compile or link. See the file config.log for the"
1510 ++ echo "*** exact error that occured. This usually means SDL was incorrectly installed"
1511 ++ echo "*** or that you have moved SDL since it was installed. In the latter case, you"
1512 ++ echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
1513 ++ CFLAGS="$ac_save_CFLAGS"
1514 ++ CXXFLAGS="$ac_save_CXXFLAGS"
1515 ++ LIBS="$ac_save_LIBS"
1516 ++ fi
1517 ++ fi
1518 ++ SDL_CFLAGS=""
1519 ++ SDL_LIBS=""
1520 ++ ifelse([$3], , :, [$3])
1521 ++ fi
1522 ++ AC_SUBST(SDL_CFLAGS)
1523 ++ AC_SUBST(SDL_LIBS)
1524 ++ rm -f conf.sdltest
1525 ++])