Skip to content

Commit

Permalink
fix(msvc): fixed debug build in MSVC (synfig#2812)
Browse files Browse the repository at this point in the history
1 issue:
"can't decrement vector iterator before begin"

2 issue:
"vector iterators incompatible"
  • Loading branch information
ice0 authored Aug 28, 2022
1 parent c6eb41d commit dd55c0f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions synfig-core/src/synfig/gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Gradient::operator+(const Gradient &rhs) const
if (i == end())
current = pj = j++, left = right = pi;
else
if (j == end())
if (j == rhs.end())
current = pi = i++, left = right = pj;
else
if (i->pos < j->pos)
Expand Down Expand Up @@ -310,14 +310,14 @@ CompiledGradient::set(const Gradient &gradient, bool repeat, bool zigzag) {
}

// add flipped points for zigzag
// memory for points already reserved enough, so all iterators will stay valid
if (zigzag) {
// add mirror in order:
// 0 1 2 3 4
// 0 1 2 3 4 - 4 3 2 1 0
for(Gradient::reverse_iterator ri = cpoints.rbegin(); ri != cpoints.rend(); ++ri) {
ri->pos *= 0.5;
cpoints.push_back(*ri);
for (int index = cpoints.size(); index > 0; --index) {
auto& elem = cpoints[index-1];
elem.pos *= 0.5;
cpoints.push_back(elem);
cpoints.back().pos = 1.0 - cpoints.back().pos;
}
}
Expand Down

0 comments on commit dd55c0f

Please sign in to comment.