Update agg patches.

This commit is contained in:
Jon Ciesla 2013-06-27 08:55:24 -05:00
commit bf231a208c
16 changed files with 225 additions and 40 deletions

View file

@ -1,7 +1,7 @@
From 085983cdd2bdf79247a12fcee603e6f1bd6b587e Mon Sep 17 00:00:00 2001
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/11] Fix non-terminating loop conditions when len=1
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)

View file

@ -1,7 +1,7 @@
From dab3a675d4fe1294f12f65c7ae72fd740b043a19 Mon Sep 17 00:00:00 2001
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/11] Cure recursion by aborting if the co-ordinates are to
Subject: [PATCH 02/15] Cure recursion by aborting if the co-ordinates are to
big to handle
---

View file

@ -1,7 +1,7 @@
From 3dbfb18b984dd2bdd2b1fd33108817ffe581c09b Mon Sep 17 00:00:00 2001
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/11] Get coordinates from previous vertex if last command is
Subject: [PATCH 03/15] Get coordinates from previous vertex if last command is
path_cmd_end_poly
---

View file

@ -1,7 +1,7 @@
From e12c9df003505093b6fc81ed6458185271825146 Mon Sep 17 00:00:00 2001
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/11] Make rasterizer_outline_aa ignore close_polygon when
Subject: [PATCH 04/15] Make rasterizer_outline_aa ignore close_polygon when
vertex count < 3
---

View file

@ -1,7 +1,7 @@
From 9fb6c7e39bb0cf01f7268a55b13d7ae828ab8321 Mon Sep 17 00:00:00 2001
From b8c43fb0ba13af0cc2b1050f48f81d76d2fdf0c7 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 15:04:05 +0100
Subject: [PATCH 05/11] Remove VC++ 6 workaround
Subject: [PATCH 05/15] Remove VC++ 6 workaround
---
include/agg_renderer_scanline.h | 29 +----------------------------

View file

@ -1,14 +1,14 @@
From 09c4b068b9512e33736e6f23896ad2522f3b65da Mon Sep 17 00:00:00 2001
From 9422570f4e099a834fc43619f7b2a7eb6b442e25 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 15:31:01 +0100
Subject: [PATCH 06/11] Implement grain-merge blending mode (GIMP)
Subject: [PATCH 06/15] Implement grain-merge blending mode (GIMP)
---
include/agg_pixfmt_rgba.h | 42 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index 79d10dc..99b1c9f 100644
index 79d10dc..f576ce4 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -1401,9 +1401,46 @@ namespace agg
@ -46,9 +46,9 @@ index 79d10dc..99b1c9f 100644
+ if(sa)
+ {
+ calc_type da = p[Order::A];
+ calc_type dr = sr + p[Order::R] - 128;
+ calc_type dg = sg + p[Order::G] - 128;
+ calc_type db = sb + p[Order::B] - 128;
+ int dr = sr + p[Order::R] - 128;
+ int dg = sg + p[Order::G] - 128;
+ int db = sb + p[Order::B] - 128;
+ p[Order::R] = (value_type)(dr < 0 ? 0 : (dr > 255 ? 255 : dr));
+ p[Order::G] = (value_type)(dg < 0 ? 0 : (dg > 255 ? 255 : dg));
+ p[Order::B] = (value_type)(db < 0 ? 0 : (db > 255 ? 255 : db));

View file

@ -1,17 +1,17 @@
From 6cef3ddecc1b8a614ba4d47bf9daf6b04bea9995 Mon Sep 17 00:00:00 2001
From abd440342e166a90d08610bf5b31d2a8357eafbe Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 15:43:18 +0100
Subject: [PATCH 07/11] Implement grain-extract blending mode (GIMP)
Subject: [PATCH 07/15] Implement grain-extract blending mode (GIMP)
---
include/agg_pixfmt_rgba.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
include/agg_pixfmt_rgba.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index 99b1c9f..e0a6dc1 100644
index f576ce4..42f0a05 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -1442,6 +1442,51 @@ namespace agg
@@ -1442,6 +1442,52 @@ namespace agg
}
};
@ -35,9 +35,10 @@ index 99b1c9f..e0a6dc1 100644
+ unsigned sa, unsigned cover)
+ {
+ calc_type da = (p[Order::A] * sa + 255) >> 8;
+ calc_type dr = p[Order::R] - sr + 128;
+ calc_type dg = p[Order::G] - sg + 128;
+ calc_type db = p[Order::B] - sb + 128;
+
+ int dr = p[Order::R] - sr + 128;
+ int dg = p[Order::G] - sg + 128;
+ int db = p[Order::B] - sb + 128;
+
+ dr = dr < 0 ? 0 : (dr > 255 ? 255 : dr);
+ dg = dg < 0 ? 0 : (dg > 255 ? 255 : dg);
@ -63,7 +64,7 @@ index 99b1c9f..e0a6dc1 100644
//======================================================comp_op_table_rgba
template<class ColorT, class Order> struct comp_op_table_rgba
{
@@ -1489,6 +1534,7 @@ namespace agg
@@ -1489,6 +1535,7 @@ namespace agg
comp_op_rgba_invert <ColorT,Order>::blend_pix,
comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
comp_op_rgba_grain_merge<ColorT,Order>::blend_pix,
@ -71,7 +72,7 @@ index 99b1c9f..e0a6dc1 100644
0
};
@@ -1525,6 +1571,7 @@ namespace agg
@@ -1525,6 +1572,7 @@ namespace agg
comp_op_invert, //----comp_op_invert
comp_op_invert_rgb, //----comp_op_invert_rgb
comp_op_grain_merge, //----comp_op_grain_merge

View file

@ -1,7 +1,7 @@
From 6f8f30a6af5b335c14065e421d953b821fb7660f Mon Sep 17 00:00:00 2001
From 2688af280836b95908d3cfd6915510d55de673b8 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 16:15:01 +0100
Subject: [PATCH 08/11] Declare multiplication and division operators as const
Subject: [PATCH 08/15] Declare multiplication and division operators as const
---
include/agg_trans_affine.h | 8 ++++----

View file

@ -1,7 +1,7 @@
From 7669098f8e80929eec2e380967e12b31b68a4310 Mon Sep 17 00:00:00 2001
From be9ed90897bc43b4547a3a1f8046827caaf13b4c Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 16:15:36 +0100
Subject: [PATCH 09/11] Add a static identity transformation
Subject: [PATCH 09/15] Add a static identity transformation
---
include/agg_trans_affine.h | 1 +

View file

@ -1,7 +1,7 @@
From 15fa2c5afe649b4f41aede636243c9bea7aa74a4 Mon Sep 17 00:00:00 2001
From 749c8cd11e9e6f81e93ae5ce19258431722b6bdf Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 16:43:25 +0100
Subject: [PATCH 10/11] Add renderer_scanline_aa_alpha
Subject: [PATCH 10/15] Add renderer_scanline_aa_alpha
---
include/agg_pixfmt_rgba.h | 24 +++++++++++++-
@ -10,10 +10,10 @@ Subject: [PATCH 10/11] Add renderer_scanline_aa_alpha
3 files changed, 122 insertions(+), 1 deletion(-)
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index e0a6dc1..d912ba3 100644
index 42f0a05..6c4bc37 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -2246,7 +2246,6 @@ namespace agg
@@ -2247,7 +2247,6 @@ namespace agg
}
@ -21,7 +21,7 @@ index e0a6dc1..d912ba3 100644
//--------------------------------------------------------------------
void blend_color_vspan(int x, int y,
unsigned len,
@@ -2750,6 +2749,29 @@ namespace agg
@@ -2751,6 +2750,29 @@ namespace agg
}
//--------------------------------------------------------------------

View file

@ -1,7 +1,7 @@
From 85de27e76d433db8c577e9475e29794cad5f999a Mon Sep 17 00:00:00 2001
From 0ec68d7f5695403eccac75025ba7f6f7ecf1814e Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sun, 19 May 2013 16:49:08 +0100
Subject: [PATCH 11/11] Avoid division by zero in color-burn mode
Subject: [PATCH 11/15] Avoid division by zero in color-burn mode
FIXME: re-work using latest math from http://www.w3.org/TR/SVGCompositing/
---
@ -9,7 +9,7 @@ FIXME: re-work using latest math from http://www.w3.org/TR/SVGCompositing/
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index d912ba3..e30860c 100644
index 6c4bc37..5d6b511 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -1027,6 +1027,21 @@ namespace agg

View file

@ -0,0 +1,26 @@
From bf0e0b71360cfbc690a29f4abe15d7b9b61b8479 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sat, 22 Jun 2013 12:11:54 +0100
Subject: [PATCH 12/15] Avoid pixel artifacts when compositing
Change src_over alpha to avoid pixel artifacts by reordering computations.
---
include/agg_pixfmt_rgba.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h
index 5d6b511..bb255cd 100644
--- a/include/agg_pixfmt_rgba.h
+++ b/include/agg_pixfmt_rgba.h
@@ -346,7 +346,7 @@ namespace agg
p[Order::R] = (value_type)(sr + ((p[Order::R] * s1a + base_mask) >> base_shift));
p[Order::G] = (value_type)(sg + ((p[Order::G] * s1a + base_mask) >> base_shift));
p[Order::B] = (value_type)(sb + ((p[Order::B] * s1a + base_mask) >> base_shift));
- p[Order::A] = (value_type)(sa + p[Order::A] - ((sa * p[Order::A] + base_mask) >> base_shift));
+ p[Order::A] = (value_type)(sa + ((p[Order::A] * s1a + base_mask) >> base_shift));
}
};
--
1.8.1.4

View file

@ -0,0 +1,93 @@
From 6f1ab5f4b470bcf4e7e72aac6e2f7f6ee3e7b424 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sat, 22 Jun 2013 12:16:42 +0100
Subject: [PATCH 13/15] Modify agg conv classes to allow access to the original
geometry type
---
include/agg_conv_adaptor_vcgen.h | 2 ++
include/agg_conv_adaptor_vpgen.h | 1 +
include/agg_conv_clip_polygon.h | 1 +
include/agg_conv_clip_polyline.h | 1 +
include/agg_conv_smooth_poly1.h | 2 ++
5 files changed, 7 insertions(+)
diff --git a/include/agg_conv_adaptor_vcgen.h b/include/agg_conv_adaptor_vcgen.h
index 7bd9b07..fef4579 100644
--- a/include/agg_conv_adaptor_vcgen.h
+++ b/include/agg_conv_adaptor_vcgen.h
@@ -38,6 +38,7 @@ namespace agg
void rewind(unsigned) {}
unsigned vertex(double*, double*) { return path_cmd_stop; }
+ unsigned type() const { return 0; }
};
@@ -73,6 +74,7 @@ namespace agg
}
unsigned vertex(double* x, double* y);
+ unsigned type() const { return m_source->type(); }
private:
// Prohibit copying
diff --git a/include/agg_conv_adaptor_vpgen.h b/include/agg_conv_adaptor_vpgen.h
index dca9415..a39102d 100644
--- a/include/agg_conv_adaptor_vpgen.h
+++ b/include/agg_conv_adaptor_vpgen.h
@@ -42,6 +42,7 @@ namespace agg
void rewind(unsigned path_id);
unsigned vertex(double* x, double* y);
+ unsigned type() const { return m_source->type(); }
private:
conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
diff --git a/include/agg_conv_clip_polygon.h b/include/agg_conv_clip_polygon.h
index 3c34590..e417a7d 100644
--- a/include/agg_conv_clip_polygon.h
+++ b/include/agg_conv_clip_polygon.h
@@ -60,6 +60,7 @@ namespace agg
double y1() const { return base_type::vpgen().y1(); }
double x2() const { return base_type::vpgen().x2(); }
double y2() const { return base_type::vpgen().y2(); }
+ unsigned type() const { return base_type::type(); }
private:
conv_clip_polygon(const conv_clip_polygon<VertexSource>&);
diff --git a/include/agg_conv_clip_polyline.h b/include/agg_conv_clip_polyline.h
index d45067f..0de4b57 100644
--- a/include/agg_conv_clip_polyline.h
+++ b/include/agg_conv_clip_polyline.h
@@ -60,6 +60,7 @@ namespace agg
double y1() const { return base_type::vpgen().y1(); }
double x2() const { return base_type::vpgen().x2(); }
double y2() const { return base_type::vpgen().y2(); }
+ unsigned type() const { return base_type::type(); }
private:
conv_clip_polyline(const conv_clip_polyline<VertexSource>&);
diff --git a/include/agg_conv_smooth_poly1.h b/include/agg_conv_smooth_poly1.h
index 15f7f8d..0956c4e 100644
--- a/include/agg_conv_smooth_poly1.h
+++ b/include/agg_conv_smooth_poly1.h
@@ -48,6 +48,7 @@ namespace agg
void smooth_value(double v) { base_type::generator().smooth_value(v); }
double smooth_value() const { return base_type::generator().smooth_value(); }
+ unsigned type() const { return base_type::type(); }
private:
conv_smooth_poly1(const conv_smooth_poly1<VertexSource>&);
@@ -70,6 +71,7 @@ namespace agg
void smooth_value(double v) { m_smooth.generator().smooth_value(v); }
double smooth_value() const { return m_smooth.generator().smooth_value(); }
+ unsigned type() const { return m_smooth.type(); }
private:
conv_smooth_poly1_curve(const conv_smooth_poly1_curve<VertexSource>&);
--
1.8.1.4

View file

@ -0,0 +1,30 @@
From 6433a64f4cd41e88499386b0b7c7ae05d30683b8 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sat, 22 Jun 2013 12:33:32 +0100
Subject: [PATCH 14/15] Avoid potential zero division resulting in nan in
agg::gamma_linear
---
include/agg_gamma_functions.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/agg_gamma_functions.h b/include/agg_gamma_functions.h
index fa38a45..beb0c04 100644
--- a/include/agg_gamma_functions.h
+++ b/include/agg_gamma_functions.h
@@ -94,7 +94,11 @@ namespace agg
{
if(x < m_start) return 0.0;
if(x > m_end) return 1.0;
- return (x - m_start) / (m_end - m_start);
+ double delta = m_end - m_start;
+ // avoid nan from potential zero division
+ // https://github.com/mapnik/mapnik/issues/761
+ if (delta <= 0.0) return 0.0;
+ return (x - m_start) / delta;
}
private:
--
1.8.1.4

View file

@ -0,0 +1,24 @@
From ca818d4dcd428c5560fc3c341fbaf427a7485e32 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Sat, 22 Jun 2013 12:34:37 +0100
Subject: [PATCH 15/15] Ensure first value in the gamma table is always zero
---
include/agg_gamma_functions.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/agg_gamma_functions.h b/include/agg_gamma_functions.h
index beb0c04..b8eda52 100644
--- a/include/agg_gamma_functions.h
+++ b/include/agg_gamma_functions.h
@@ -49,6 +49,7 @@ namespace agg
double operator() (double x) const
{
+ if (x == 0.0) return 0.0;
return pow(x, m_gamma);
}
--
1.8.1.4

View file

@ -1,7 +1,7 @@
Summary: Anti-Grain Geometry graphical rendering engine
Name: agg
Version: 2.5
Release: 17%{?dist}
Release: 18%{?dist}
Group: System Environment/Libraries
URL: http://www.antigrain.com
License: GPLv2+
@ -32,6 +32,10 @@ Patch108: 0008-Declare-multiplication-and-division-operators-as-con.patch
Patch109: 0009-Add-a-static-identity-transformation.patch
Patch110: 0010-Add-renderer_scanline_aa_alpha.patch
Patch111: 0011-Avoid-division-by-zero-in-color-burn-mode.patch
Patch112: 0012-Avoid-pixel-artifacts-when-compositing.patch
Patch113: 0013-Modify-agg-conv-classes-to-allow-access-to-the-origi.patch
Patch114: 0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
Patch115: 0015-Ensure-first-value-in-the-gamma-table-is-always-zero.patch
%description
A High Quality Rendering Engine for C++.
@ -63,6 +67,10 @@ using agg.
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
aclocal
autoheader
autoconf
@ -108,6 +116,9 @@ mv __clean_examples __dist_examples/examples
rm -rf $RPM_BUILD_ROOT
%changelog
* Sat Jun 22 2013 Tom Hughes <tom@compton.nu> - 2.5-18
- Update mapnik patches
* Sun May 19 2013 Tom Hughes <tom@compton.nu> - 2.5-17
- Add patches from mapnik