summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-04-16 07:50:37 +0000
committerJon A. Cruz <jon@joncruz.org>2012-04-16 07:50:37 +0000
commitf8ae8770dd95f4a1102f6d50eb94c9ddc483a6d1 (patch)
treecbc3390a13f0c73e17b950522a9955d164c35a28 /src
parentFix for 903676 : Replace GtkCList with GtkTreeView in XML Tree, fix assert on... (diff)
downloadinkscape-f8ae8770dd95f4a1102f6d50eb94c9ddc483a6d1.tar.gz
inkscape-f8ae8770dd95f4a1102f6d50eb94c9ddc483a6d1.zip
Loop index type cleanup
(bzr r11258)
Diffstat (limited to 'src')
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp21
-rw-r--r--src/live_effects/lpe-powerstroke.cpp2
2 files changed, 15 insertions, 8 deletions
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index 2830a8026..0ce00e43b 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -435,17 +435,17 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
}
for (unsigned char_index = 0 ; char_index < _characters.size() ; ) {
- unsigned current_cluster_glyph_index, next_cluster_glyph_index;
- unsigned next_cluster_char_index;
Span const &span = _characters[char_index].span(this);
- current_cluster_glyph_index = _characters[char_index].in_glyph;
-
+ size_t next_cluster_char_index = 0; // TODO refactor to not bump via for loops
for (next_cluster_char_index = char_index + 1 ; next_cluster_char_index < _characters.size() ; next_cluster_char_index++) {
if (_characters[next_cluster_char_index].in_glyph != -1 && _characters[next_cluster_char_index].char_attributes.is_cursor_position)
+ {
break;
+ }
}
+ size_t next_cluster_glyph_index = 0;
if (next_cluster_char_index == _characters.size()) {
next_cluster_glyph_index = _glyphs.size();
} else {
@@ -454,11 +454,16 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
double start_offset = offset + span.x_start + _characters[char_index].x;
double cluster_width = 0.0;
- for (int glyph_index = current_cluster_glyph_index ; glyph_index < next_cluster_glyph_index ; glyph_index++)
+ size_t const current_cluster_glyph_index = _characters[char_index].in_glyph;
+ for (size_t glyph_index = current_cluster_glyph_index ; glyph_index < next_cluster_glyph_index ; glyph_index++)
+ {
cluster_width += _glyphs[glyph_index].width;
+ }
// TODO block progression?
if (span.direction == RIGHT_TO_LEFT)
+ {
start_offset -= cluster_width;
+ }
double end_offset = start_offset + cluster_width;
int unused = 0;
@@ -504,17 +509,19 @@ void Layout::fitToPathAlign(SVGLength const &startOffset, Path const &path)
if (_directions_are_orthogonal(_blockProgression(), TOP_TO_BOTTOM)) {
double rotation = atan2(-tangent[Geom::X], tangent[Geom::Y]);
- for (int glyph_index = current_cluster_glyph_index; glyph_index < next_cluster_glyph_index ; glyph_index++) {
+ for (size_t glyph_index = current_cluster_glyph_index; glyph_index < next_cluster_glyph_index ; glyph_index++) {
_glyphs[glyph_index].x = midpoint[Geom::Y] - tangent[Geom::X] * _glyphs[glyph_index].y - span.chunk(this).left_x;
_glyphs[glyph_index].y = midpoint[Geom::X] + tangent[Geom::Y] * _glyphs[glyph_index].y - _lines.front().baseline_y;
_glyphs[glyph_index].rotation += rotation;
}
} else {
double rotation = atan2(tangent[Geom::Y], tangent[Geom::X]);
- for (int glyph_index = current_cluster_glyph_index; glyph_index < next_cluster_glyph_index ; glyph_index++) {
+ for (size_t glyph_index = current_cluster_glyph_index; glyph_index < next_cluster_glyph_index ; glyph_index++) {
double tangent_shift = -cluster_width * 0.5 + _glyphs[glyph_index].x - (_characters[char_index].x + span.x_start);
if (span.direction == RIGHT_TO_LEFT)
+ {
tangent_shift += cluster_width;
+ }
_glyphs[glyph_index].x = midpoint[Geom::X] + tangent[Geom::X] * tangent_shift - tangent[Geom::Y] * _glyphs[glyph_index].y - span.chunk(this).left_x;
_glyphs[glyph_index].y = midpoint[Geom::Y] + tangent[Geom::Y] * tangent_shift + tangent[Geom::X] * _glyphs[glyph_index].y - _lines.front().baseline_y;
_glyphs[glyph_index].rotation += rotation;
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 8d5888e37..3b6af3cb6 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -209,7 +209,7 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::SBasis>
Geom::Piecewise<Geom::SBasis> const & y, // width path
LineJoinType jointype,
double miter_limit,
- bool forward_direction,
+ bool /*forward_direction*/,
double tol=Geom::EPSILON)
{
/* per definition, each discontinuity should be fixed with a join-ending, as defined by linejoin_type