[Libreoffice-commits] core.git: drawinglayer/source

Stephan Bergmann sbergman at redhat.com
Mon Oct 12 05:46:10 PDT 2015


 drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 7a1c0ad333073fcf2a90779f31ac0c75b1598c4e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 12 14:41:16 2015 +0200

    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

diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index a1c27c9..bea38f3 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;


More information about the Libreoffice-commits mailing list