fix issues reported by scan-build - closes #2813

This commit is contained in:
Dane Springmeyer 2015-05-14 18:00:25 -07:00
parent 53be585240
commit 956de13d4e
4 changed files with 21 additions and 15 deletions

View File

@ -330,8 +330,8 @@ struct gray8T
//--------------------------------------------------------------------
self_type& opacity(double a_)
{
if (a_ < 0) a_ = 0;
else if (a_ > 1) a_ = 1;
if (a_ < 0) a = 0;
else if (a_ > 1) a = 1;
else a = (value_type)uround(a_ * double(base_mask));
return *this;
}

View File

@ -80,8 +80,8 @@ struct rgba
//--------------------------------------------------------------------
rgba& opacity(double a_)
{
if (a_ < 0) a_ = 0;
else if (a_ > 1) a_ = 1;
if (a_ < 0) a = 0;
else if (a_ > 1) a = 1;
else a = a_;
return *this;
}
@ -472,8 +472,8 @@ struct rgba8T
//--------------------------------------------------------------------
self_type& opacity(double a_)
{
if (a_ < 0) a_ = 0;
else if (a_ > 1) a_ = 1;
if (a_ < 0) a = 0;
else if (a_ > 1) a = 1;
else a = (value_type)uround(a_ * double(base_mask));
return *this;
}
@ -882,8 +882,8 @@ struct rgba16
//--------------------------------------------------------------------
AGG_INLINE self_type& opacity(double a_)
{
if (a_ < 0) a_ = 0;
if (a_ > 1) a_ = 1;
if (a_ < 0) a = 0;
if (a_ > 1) a = 1;
a = value_type(uround(a_ * double(base_mask)));
return *this;
}
@ -1238,8 +1238,8 @@ struct rgba32
//--------------------------------------------------------------------
AGG_INLINE self_type& opacity(double a_)
{
if (a_ < 0) a_ = 0;
else if (a_ > 1) a_ = 1;
if (a_ < 0) a = 0;
else if (a_ > 1) a = 1;
else a = value_type(a_);
return *this;
}

View File

@ -239,10 +239,9 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
double last_cluster_angle = 999;
int current_cluster = -1;
pixel_position cluster_offset;
double angle;
double angle = 0;
rotation rot;
double last_glyph_spacing = 0.;
double last_glyph_spacing = 0.0;
for (auto const& glyph : line)
{
if (current_cluster != static_cast<int>(glyph.char_index))
@ -250,13 +249,17 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
if (adjust)
{
if (!off_pp.move(sign * (layout.cluster_width(current_cluster) + last_glyph_spacing)))
{
return false;
}
last_glyph_spacing = adjust_character_spacing;
}
else
{
if (!off_pp.move_to_distance(sign * (layout.cluster_width(current_cluster) + last_glyph_spacing)))
{
return false;
}
last_glyph_spacing = glyph.format->character_spacing * scale_factor_;
}
current_cluster = glyph.char_index;
@ -274,7 +277,10 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
last_cluster_angle = angle;
}
if (std::abs(angle) > M_PI/2) ++upside_down_glyph_count;
if (std::abs(angle) > M_PI/2)
{
++upside_down_glyph_count;
}
pixel_position pos = off_pp.current_position() + cluster_offset;
// Center the text on the line

@ -1 +1 @@
Subproject commit ea6aa0ed3c54a079f3cd761237d3f986e39ee876
Subproject commit 7fd9b1954e87105c69bb0670db486147e2284ff5