slackbuilds_ponce/libraries/agg/patches/0004-Make-rasterizer_outline_aa-ignore-close_polygon-when.patch
Matteo Bernardini e28787e9e0 libraries/agg: Added patches from fedora.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
2014-08-03 16:34:16 +07:00

138 lines
4.5 KiB
Diff

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