diff options
Diffstat (limited to 'slideshow/source/engine/transitions')
-rw-r--r-- | slideshow/source/engine/transitions/randomwipe.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/slideshow/source/engine/transitions/randomwipe.cxx b/slideshow/source/engine/transitions/randomwipe.cxx index 22c51e38852e..d8ac4a3da687 100644 --- a/slideshow/source/engine/transitions/randomwipe.cxx +++ b/slideshow/source/engine/transitions/randomwipe.cxx @@ -68,13 +68,11 @@ RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) m_rect.transform( aTransform ); // mix up: - for ( sal_Int32 i = (nElements / 2); i--; ) + for (sal_Int32 nIndex=0; nIndex<nElements; ++nIndex) { - const sal_Int32 pos1 = getRandomOrdinal(nElements); - const sal_Int32 pos2 = getRandomOrdinal(nElements); - const ::basegfx::B2DPoint point( m_positions[ pos1 ] ); - m_positions[ pos1 ] = m_positions[ pos2 ]; - m_positions[ pos2 ] = point; + const sal_Int32 nOtherIndex (getRandomOrdinal(nElements)); + OSL_ASSERT(nOtherIndex>=0 && nOtherIndex<nElements); + ::std::swap(m_positions[nIndex], m_positions[nOtherIndex]); } } |