diff options
Diffstat (limited to 'chart2/source/view/charttypes/Splines.cxx')
-rw-r--r-- | chart2/source/view/charttypes/Splines.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx index 6d37d7444868..67ecac93b64c 100644 --- a/chart2/source/view/charttypes/Splines.cxx +++ b/chart2/source/view/charttypes/Splines.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: Splines.cxx,v $ - * $Revision: 1.11.44.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -323,17 +320,17 @@ void SplineCalculater::CalculateCubicSplines( rResult.SequenceY.realloc(0); rResult.SequenceZ.realloc(0); - sal_Int32 nOuterCount = rInput.SequenceX.getLength();
- if( !nOuterCount )
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength(); + if( !nOuterCount ) return; - rResult.SequenceX.realloc(nOuterCount);
- rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceX.realloc(nOuterCount); + rResult.SequenceY.realloc(nOuterCount); rResult.SequenceZ.realloc(nOuterCount); - for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
- {
- if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter ) + { + if( rInput.SequenceX[nOuter].getLength() <= 1 ) continue; //we need at least two points sal_Int32 nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1 @@ -461,17 +458,17 @@ void SplineCalculater::CalculateBSplines( rResult.SequenceY.realloc(0); rResult.SequenceZ.realloc(0); - sal_Int32 nOuterCount = rInput.SequenceX.getLength();
- if( !nOuterCount )
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength(); + if( !nOuterCount ) return; // no input - rResult.SequenceX.realloc(nOuterCount);
- rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceX.realloc(nOuterCount); + rResult.SequenceY.realloc(nOuterCount); rResult.SequenceZ.realloc(nOuterCount); - for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
- {
- if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter ) + { + if( rInput.SequenceX[nOuter].getLength() <= 1 ) continue; // need at least 2 control points sal_Int32 n = rInput.SequenceX[nOuter].getLength()-1; // maximum index of control points |