summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-03 17:12:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-06 14:13:27 +0100
commit8f436d3de7e99268a8862664d2cb2574231c3b18 (patch)
tree0a07dd3cecbd7bc5b0293006bb8691e33c5cca75 /svx
parente5ab3685550cf35c3eb9cb47530044f2d86433d5 (diff)
use comphelper::rng::uniform_*_distribution everywhere
and automatically seed from time on first use coverity#1242393 Don't call rand coverity#1242404 Don't call rand coverity#1242410 Don't call rand and additionally allow 0xFF as a value coverity#1242409 Don't call rand coverity#1242399 Don't call rand coverity#1242372 Don't call rand coverity#1242377 Don't call rand coverity#1242378 Don't call rand coverity#1242379 Don't call rand coverity#1242382 Don't call rand coverity#1242383 Don't call rand coverity#1242402 Don't call rand coverity#1242397 Don't call rand coverity#1242390 Don't call rand coverity#1242389 Don't call rand coverity#1242388 Don't call rand coverity#1242386 Don't call rand coverity#1242384 Don't call rand coverity#1242394 Don't call rand Change-Id: I241feab9cb370e091fd6ccaba2af941eb95bc7cf
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx6
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx32
2 files changed, 10 insertions, 28 deletions
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index f4cccca0797a..bdd163d3c08c 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/random.hxx>
#include <vcl/svapp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <svx/svdouno.hxx>
@@ -254,7 +255,10 @@ namespace
for(sal_uInt32 a(0L); a < aResult.count(); a++)
{
- Color aColor(rand()%255, rand()%255, rand()%255);
+ int nR = comphelper::rng::uniform_int_distribution(0, 254);
+ int nG = comphelper::rng::uniform_int_distribution(0, 254);
+ int nB = comphelper::rng::uniform_int_distribution(0, 254);
+ Color aColor(nR, nG, nB);
impPaintStrokePolygon(aResult.getB2DPolygon(a), rOutDev, aColor);
}
}
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index f64aea30c499..ae6f6d58dd28 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <comphelper/random.hxx>
#include <svx/sdrpaintwindow.hxx>
#include <sdr/overlay/overlaymanagerbuffered.hxx>
#include <svx/svdpntv.hxx>
@@ -174,7 +175,10 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
if(bDoPaintForVisualControlRegion)
{
- const Color aColor((((((rand()&0x7f)|0x80)<<8L)|((rand()&0x7f)|0x80))<<8L)|((rand()&0x7f)|0x80));
+ int nR = comphelper::rng::uniform_int_distribution(0, 0x7F-1);
+ int nG = comphelper::rng::uniform_int_distribution(0, 0x7F-1);
+ int nB = comphelper::rng::uniform_int_distribution(0, 0x7F-1);
+ const Color aColor(((((nR|0x80)<<8L)|(nG|0x80))<<8L)|(nB|0x80));
mrOutputDevice.SetLineColor(aColor);
mrOutputDevice.SetFillColor();
@@ -183,32 +187,6 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
#endif
}
-// while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
-// {
-// // for each rectangle, copy the area
-// const Point aTopLeft(aRegionRectanglePixel.TopLeft());
-// const Size aSize(aRegionRectanglePixel.GetSize());
-
-// mrOutputDevice.DrawOutDev(
-// aTopLeft, aSize,
-// aTopLeft, aSize,
-// maPreRenderDevice);
-
-//#ifdef DBG_UTIL
-// // #i74769#
-// static bool bDoPaintForVisualControlRegion(false);
-// if(bDoPaintForVisualControlRegion)
-// {
-// Color aColor((((((rand()&0x7f)|0x80)<<8L)|((rand()&0x7f)|0x80))<<8L)|((rand()&0x7f)|0x80));
-// mrOutputDevice.SetLineColor(aColor);
-// mrOutputDevice.SetFillColor();
-// mrOutputDevice.DrawRect(aRegionRectanglePixel);
-// }
-//#endif
-// }
-
-// aRegionPixel.EndEnumRects(aRegionHandle);
-
mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest);
maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource);
}