Hi libreoffice developers....
Creating a 'bug'
http://tools.openoffice.org/issues/show_bug.cgi?id=80637
saw no action in 3 years.... Here is hoping that posting the patch to this
new project will :-)
Thanks in advance,
NeilBrown
From fd597f0d31131544e1e3e1f3af6de826974ed8f8 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 28 Sep 2010 21:39:19 +1000
Subject: [PATCH] Improve randomisation in 'dissolve' transition.
The loop for randomizing a list in the dissolve transition is poor.
It randomly chooses two element and swaps them, and does this N/2 times.
Thus a total of N elements are moved.
It is probable that several elements will be swapped multiple times,
leaving it probable that several other elements will not be swapped at all.
This fact is quite visible when transitioning between two very different
slides (e.g. 2 photos). While there is a lot of randomness, there is a
clearly perceptible top-to-bottom 'wipe' happening at the same time.
So change the loop to provide true randomness.
We randomly choose an element for the last position.
Then randomly choose one of the remaining elements for the second
last position, etc.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/slideshow/source/engine/transitions/randomwipe.cxx
b/slideshow/source/engine/transitions/randomwipe.cxx
index af0698d..0d5a0d6 100644
--- a/slideshow/source/engine/transitions/randomwipe.cxx
+++ b/slideshow/source/engine/transitions/randomwipe.cxx
@@ -68,10 +68,9 @@ RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars )
m_rect.transform( aTransform );
// mix up:
- for ( sal_Int32 i = (nElements / 2); i--; )
+ for ( sal_Int32 pos1 = nElements ; i-- ; )
{
- const sal_Int32 pos1 = getRandomOrdinal(nElements);
- const sal_Int32 pos2 = getRandomOrdinal(nElements);
+ const sal_Int32 pos2 = getRandomOrdinal(pos1+1);
const ::basegfx::B2DPoint point( m_positions[ pos1 ] );
m_positions[ pos1 ] = m_positions[ pos2 ];
m_positions[ pos2 ] = point;
Context
- [Libreoffice] [PATCH] Improve randomisation in 'dissolve' transition. · Neil Brown
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.