From 7a1c0ad333073fcf2a90779f31ac0c75b1598c4e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 12 Oct 2015 14:41:16 +0200 Subject: Reduce scope of fTexStart/Stop even further ...than 92c8d74c543aa94cd512369072975dca7006d5b3 "CppCheck : reduce variables scope" did, to make it clear that it is OK to move these into the for loop: the values these variables receive (when bCreateTextureCoordinates is true) are only relevant for each immediately following call to impAddInBetweenFill, and are only actually used inside impAddInBetweenFill when bCreateTextureCoordinates (which is also passed into the call) is true. Change-Id: Ib9e315d80a04736fb6b49144c8f09239ac351c7f --- drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index a1c27c9f5d26..bea38f3ec761 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -646,9 +646,6 @@ namespace drawinglayer if(bAcceptPair) { - double fTexStart(0.0); - double fTexStop(1.0); - if(bCreateNormals) { impCreateInBetweenNormals(aPolB, aPolA, bSmoothHorizontalNormals); @@ -728,6 +725,8 @@ namespace drawinglayer if(bHasSlant) { + double fTexStart{}; + double fTexStop{}; if(bCreateTextureCoordinates) { fTexStart = fTexHeightPos * fInvTexHeight; @@ -818,6 +817,8 @@ namespace drawinglayer if(bHasSlant) { + double fTexStart{}; + double fTexStop{}; if(bCreateTextureCoordinates) { fTexStart = (fTexHeightPos + aTexHeightArray[a] + aTexHeightArray[(a + 1L) % nLoopCount]) * fInvTexHeight; @@ -839,6 +840,8 @@ namespace drawinglayer } } + double fTexStart{}; + double fTexStop{}; if(bCreateTextureCoordinates) { fTexStart = (fTexHeightPos + aTexHeightArray[a]) * fInvTexHeight; -- cgit