hrev52817 adds 1 changeset to branch 'master'
old head: d1f885b435e9892ac028f4be2b80536b9dd37413
new head: 434c34711184eaccfd716afb0187d642e2208ce9
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=434c34711184+%5Ed1f885b435e9
----------------------------------------------------------------------------
434c34711184: headers/libs/agg Fix PVS 33
* Fix successive assignment of 'da'
* also trailing whitespace removal
Change-Id: Ic127150c18c042839d4104ccc5830adf19550399
Reviewed-on: https://review.haiku-os.org/c/954
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Rob Gill <rrobgill@xxxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev52817
Commit: 434c34711184eaccfd716afb0187d642e2208ce9
URL: https://git.haiku-os.org/haiku/commit/?id=434c34711184
Author: Rob Gill <rrobgill@xxxxxxxxxxxxxx>
Date: Mon Jan 28 00:17:07 2019 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Tue Jan 29 04:04:01 2019 UTC
----------------------------------------------------------------------------
1 file changed, 55 insertions(+), 56 deletions(-)
headers/libs/agg/agg_math_stroke.h | 111 ++++++++++++++++-----------------
----------------------------------------------------------------------------
diff --git a/headers/libs/agg/agg_math_stroke.h
b/headers/libs/agg/agg_math_stroke.h
index c7f0dbdeb6..2854032ea6 100644
--- a/headers/libs/agg/agg_math_stroke.h
+++ b/headers/libs/agg/agg_math_stroke.h
@@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@@ -81,28 +81,28 @@ namespace agg
double approximation_scale() const { return m_approx_scale; }
void calc_cap(VertexConsumer& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
double len);
void calc_join(VertexConsumer& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
const vertex_dist& v2,
- double len1,
+ double len1,
double len2);
private:
void calc_arc(VertexConsumer& out_vertices,
- double x, double y,
- double dx1, double dy1,
+ double x, double y,
+ double dx1, double dy1,
double dx2, double dy2);
void calc_miter(VertexConsumer& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
const vertex_dist& v2,
- double dx1, double dy1,
+ double dx1, double dy1,
double dx2, double dy2,
line_join_e lj,
double ml);
@@ -134,8 +134,8 @@ namespace agg
//-----------------------------------------------------------------------
template<class VC> void math_stroke<VC>::width(double w)
- {
- m_width = w * 0.5;
+ {
+ m_width = w * 0.5;
if(m_width < 0)
{
m_width_abs = -m_width;
@@ -150,23 +150,22 @@ namespace agg
//-----------------------------------------------------------------------
template<class VC> void math_stroke<VC>::miter_limit_theta(double t)
- {
+ {
m_miter_limit = 1.0 / sin(t * 0.5) ;
}
//-----------------------------------------------------------------------
- template<class VC>
+ template<class VC>
void math_stroke<VC>::calc_arc(VC& out_vertices,
- double x, double y,
- double dx1, double dy1,
+ double x, double y,
+ double dx1, double dy1,
double dx2, double dy2)
{
double a1 = atan2(dy1 * m_width_sign, dx1 * m_width_sign);
double a2 = atan2(dy2 * m_width_sign, dx2 * m_width_sign);
- double da = a1 - a2;
+ double da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale))
* 2;
int i, n;
- da = acos(m_width_abs / (m_width_abs + 0.125 / m_approx_scale)) * 2;
out_vertices.add(coord_type(x + dx1, y + dy1));
if(m_width_sign > 0)
@@ -177,7 +176,7 @@ namespace agg
a1 += da;
for(i = 0; i < n; i++)
{
- out_vertices.add(coord_type(x + cos(a1) * m_width,
+ out_vertices.add(coord_type(x + cos(a1) * m_width,
y + sin(a1) * m_width));
a1 += da;
}
@@ -190,7 +189,7 @@ namespace agg
a1 -= da;
for(i = 0; i < n; i++)
{
- out_vertices.add(coord_type(x + cos(a1) * m_width,
+ out_vertices.add(coord_type(x + cos(a1) * m_width,
y + sin(a1) * m_width));
a1 -= da;
}
@@ -199,12 +198,12 @@ namespace agg
}
//-----------------------------------------------------------------------
- template<class VC>
+ template<class VC>
void math_stroke<VC>::calc_miter(VC& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
const vertex_dist& v2,
- double dx1, double dy1,
+ double dx1, double dy1,
double dx2, double dy2,
line_join_e lj,
double ml)
@@ -234,8 +233,8 @@ namespace agg
else
{
// Calculation of the intersection failed, most probably
- // the three points lie one straight line.
- // First check if v0 and v2 lie on the opposite sides of vector:
+ // the three points lie one straight line.
+ // First check if v0 and v2 lie on the opposite sides of vector:
// (v1.x, v1.y) -> (v1.x+dx1, v1.y-dy1), that is, the perpendicular
// to the line determined by vertices v0 and v1.
// This condition determines whether the next line segments
continues
@@ -246,7 +245,7 @@ namespace agg
if(((x2 - v0.x)*dy1 - (v0.y - y2)*dx1 < 0.0) !=
((x2 - v2.x)*dy1 - (v2.y - y2)*dx1 < 0.0))
{
- // This case means that the next segment continues
+ // This case means that the next segment continues
// the previous one (straight line)
//-----------------
out_vertices.add(coord_type(v1.x + dx1, v1.y - dy1));
@@ -261,7 +260,7 @@ namespace agg
switch(lj)
{
case miter_join_revert:
- // For the compatibility with SVG, PDF, etc,
+ // For the compatibility with SVG, PDF, etc,
// we use a simple bevel join instead of
// "smart" bevel
//-------------------
@@ -277,9 +276,9 @@ namespace agg
// If no miter-revert, calculate new dx1, dy1, dx2, dy2
//----------------
ml *= m_width_sign;
- out_vertices.add(coord_type(v1.x + dx1 + dy1 * ml,
+ out_vertices.add(coord_type(v1.x + dx1 + dy1 * ml,
v1.y - dy1 + dx1 * ml));
- out_vertices.add(coord_type(v1.x + dx2 - dy2 * ml,
+ out_vertices.add(coord_type(v1.x + dx2 - dy2 * ml,
v1.y - dy2 - dx2 * ml));
break;
}
@@ -287,10 +286,10 @@ namespace agg
}
//--------------------------------------------------------stroke_calc_cap
- template<class VC>
+ template<class VC>
void math_stroke<VC>::calc_cap(VC& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
double len)
{
out_vertices.remove_all();
@@ -328,7 +327,7 @@ namespace agg
a1 += da;
for(i = 0; i < n; i++)
{
- out_vertices.add(coord_type(v0.x + cos(a1) * m_width,
+ out_vertices.add(coord_type(v0.x + cos(a1) * m_width,
v0.y + sin(a1) * m_width));
a1 += da;
}
@@ -339,7 +338,7 @@ namespace agg
a1 -= da;
for(i = 0; i < n; i++)
{
- out_vertices.add(coord_type(v0.x + cos(a1) * m_width,
+ out_vertices.add(coord_type(v0.x + cos(a1) * m_width,
v0.y + sin(a1) * m_width));
a1 -= da;
}
@@ -349,12 +348,12 @@ namespace agg
}
//-----------------------------------------------------------------------
- template<class VC>
+ template<class VC>
void math_stroke<VC>::calc_join(VC& out_vertices,
- const vertex_dist& v0,
- const vertex_dist& v1,
+ const vertex_dist& v0,
+ const vertex_dist& v1,
const vertex_dist& v2,
- double len1,
+ double len1,
double len2)
{
double dx1, dy1, dx2, dy2;
@@ -388,8 +387,8 @@ namespace agg
case inner_miter:
calc_miter(out_vertices,
- v0, v1, v2, dx1, dy1, dx2, dy2,
- miter_join_revert,
+ v0, v1, v2, dx1, dy1, dx2, dy2,
+ miter_join_revert,
limit);
break;
@@ -400,8 +399,8 @@ namespace agg
if(d < len1 * len1 && d < len2 * len2)
{
calc_miter(out_vertices,
- v0, v1, v2, dx1, dy1, dx2, dy2,
- miter_join_revert,
+ v0, v1, v2, dx1, dy1, dx2, dy2,
+ miter_join_revert,
limit);
}
else
@@ -432,21 +431,21 @@ namespace agg
line_join_e lj = m_line_join;
if(m_line_join == round_join || m_line_join == bevel_join)
{
- // This is an optimization that reduces the number of points
+ // This is an optimization that reduces the number of points
// in cases of almost collonear segments. If there's no
// visible difference between bevel and miter joins we'd rather
- // use miter join because it adds only one point instead of
two.
+ // use miter join because it adds only one point instead of
two.
//
- // Here we calculate the middle point between the bevel points
- // and then, the distance between v1 and this middle point.
- // At outer joins this distance always less than stroke width,
+ // Here we calculate the middle point between the bevel points
+ // and then, the distance between v1 and this middle point.
+ // At outer joins this distance always less than stroke width,
// because it's actually the height of an isosceles triangle of
// v1 and its two bevel points. If the difference between this
// width and this value is small (no visible bevel) we can
switch
- // to the miter join.
+ // to the miter join.
//
- // The constant in the expression makes the result
approximately
- // the same as in round joins and caps. One can safely comment
+ // The constant in the expression makes the result
approximately
+ // the same as in round joins and caps. One can safely comment
// out this "if".
//-------------------
double dx = (dx1 + dx2) / 2;
@@ -463,9 +462,9 @@ namespace agg
case miter_join:
case miter_join_revert:
case miter_join_round:
- calc_miter(out_vertices,
- v0, v1, v2, dx1, dy1, dx2, dy2,
- lj,
+ calc_miter(out_vertices,
+ v0, v1, v2, dx1, dy1, dx2, dy2,
+ lj,
m_miter_limit);
break;