Commit 883bb677d6e93c23a12aa8ff5a73b6cb959b7c3d

Authored by Adeel Kazmi
1 parent 918d3ef5

Remove variable shadowing

Change-Id: Ica05b9e265b1907e8798fd110e8410cf00afe7b8
examples/bezier-curve/bezier-curve-example.cpp
... ... @@ -53,14 +53,6 @@ inline float Clamp(float v, float min, float max)
53 53  
54 54 struct HandlePositionConstraint
55 55 {
56   - HandlePositionConstraint(float minRelX, float maxRelX, float minRelY, float maxRelY)
57   - : minRelX(minRelX),
58   - maxRelX(maxRelX),
59   - minRelY(minRelY),
60   - maxRelY(maxRelY)
61   - {
62   - }
63   -
64 56 void operator()(Vector3& current, const PropertyInputContainer& inputs)
65 57 {
66 58 Vector3 size(inputs[0]->GetVector3());
... ... @@ -68,10 +60,10 @@ struct HandlePositionConstraint
68 60 current.y = Clamp(current.y, minRelY * size.y, maxRelY * size.y);
69 61 }
70 62  
71   - float minRelX;
72   - float maxRelX;
73   - float minRelY;
74   - float maxRelY;
  63 + float minRelX{0.0f};
  64 + float maxRelX{0.0f};
  65 + float minRelY{0.0f};
  66 + float maxRelY{0.0f};
75 67 };
76 68  
77 69 void AnimatingPositionConstraint(Vector3& current, const PropertyInputContainer& inputs)
... ... @@ -304,7 +296,7 @@ public:
304 296 positionAnimation.FinishedSignal().Connect(this, &BezierCurveExample::OnAnimationFinished);
305 297  
306 298 // Set up constraints for drag/drop
307   - Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint(-0.5, 0.5, -1, 1));
  299 + Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint{-0.5, 0.5, -1, 1});
308 300 constraint.AddSource(Source(parent, Actor::Property::SIZE));
309 301 constraint.Apply();
310 302  
... ...
examples/deferred-shading/deferred-shading.cpp
... ... @@ -183,8 +183,8 @@ Geometry CreateOctahedron(bool invertNormals)
183 183  
184 184 struct Vertex
185 185 {
186   - Vector3 position;
187   - Vector3 normal;
  186 + Vector3 position{};
  187 + Vector3 normal{};
188 188 };
189 189 Vertex vertexData[] = {
190 190 {positions[0]},
... ... @@ -624,12 +624,12 @@ private:
624 624  
625 625 int DALI_EXPORT_API main(int argc, char** argv)
626 626 {
627   - const bool showLights = [](int argc, char** argv) {
  627 + const bool showLights = [argc, argv]() {
628 628 auto endArgs = argv + argc;
629 629 return std::find_if(argv, endArgs, [](const char* arg) {
630 630 return strcmp(arg, "--show-lights") == 0;
631 631 }) != endArgs;
632   - }(argc, argv);
  632 + }();
633 633  
634 634 Application app = Application::New(&argc, &argv);
635 635 DeferredShadingExample example(app, (showLights ? DeferredShadingExample::Options::SHOW_LIGHTS : 0));
... ...
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
... ... @@ -222,9 +222,9 @@ Dali::FittingMode::Type NextMode(const Dali::FittingMode::Type oldMode)
222 222 * */
223 223 struct ImageConfiguration
224 224 {
225   - ImageConfiguration(const char* const path, const Vector2 dimensions)
226   - : path(path),
227   - dimensions(dimensions)
  225 + ImageConfiguration(const char* const imagePath, const Vector2 dims)
  226 + : path(imagePath),
  227 + dimensions(dims)
228 228 {
229 229 }
230 230 const char* path;
... ... @@ -236,11 +236,11 @@ struct ImageConfiguration
236 236 */
237 237 struct PositionedImage
238 238 {
239   - PositionedImage(ImageConfiguration& configuration, unsigned cellX, unsigned cellY, Vector2 imageGridDims)
240   - : configuration(configuration),
241   - cellX(cellX),
242   - cellY(cellY),
243   - imageGridDims(imageGridDims)
  239 + PositionedImage(ImageConfiguration& config, unsigned x, unsigned y, Vector2 imageGridDimensions)
  240 + : configuration(config),
  241 + cellX(x),
  242 + cellY(y),
  243 + imageGridDims(imageGridDimensions)
244 244 {
245 245 }
246 246  
... ... @@ -422,11 +422,10 @@ public:
422 422  
423 423 // Place the images in the grid:
424 424  
425   - std::vector<ImageConfiguration>::iterator config, end;
426   - GridFlags grid(gridWidth, maxGridHeight);
427   - std::vector<PositionedImage> placedImages;
  425 + GridFlags grid(gridWidth, maxGridHeight);
  426 + std::vector<PositionedImage> placedImages;
428 427  
429   - for(config = configurations.begin(), end = configurations.end(); config != end; ++config)
  428 + for(std::vector<ImageConfiguration>::iterator config = configurations.begin(), end = configurations.end(); config != end; ++config)
430 429 {
431 430 unsigned cellX, cellY;
432 431 Vector2 imageGridDims;
... ...
examples/line-mesh/line-mesh-example.cpp
... ... @@ -231,7 +231,7 @@ public:
231 231 mMinusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
232 232 mMinusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
233 233  
234   - Toolkit::PushButton mPlusButton = Toolkit::PushButton::New();
  234 + mPlusButton = Toolkit::PushButton::New();
235 235 mPlusButton.SetProperty(Toolkit::Button::Property::LABEL, ">>");
236 236 mPlusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
237 237 mPlusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_RIGHT);
... ...
examples/motion-blur/motion-blur-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -281,11 +281,11 @@ public:
281 281 destPos.y = localPoint.y - originOffsetY;
282 282 destPos.z = 0.0f;
283 283  
284   - float animDuration = 0.5f;
285   - mActorTapMovementAnimation = Animation::New(animDuration);
  284 + float tapMovementAnimDuration = 0.5f;
  285 + mActorTapMovementAnimation = Animation::New(tapMovementAnimDuration);
286 286 if(mMotionBlurImageView)
287 287 {
288   - mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
  288 + mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
289 289 }
290 290 mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
291 291 mActorTapMovementAnimation.Play();
... ...
examples/motion-stretch/motion-stretch-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -254,11 +254,11 @@ public:
254 254 destPos.y = localPoint.y - originOffsetY;
255 255 destPos.z = 0.0f;
256 256  
257   - float animDuration = 0.5f;
258   - mActorTapMovementAnimation = Animation::New(animDuration);
  257 + float tapMovementAnimDuration = 0.5f;
  258 + mActorTapMovementAnimation = Animation::New(tapMovementAnimDuration);
259 259 if(mMotionStretchImageView)
260 260 {
261   - mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
  261 + mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
262 262 }
263 263 mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
264 264 mActorTapMovementAnimation.Play();
... ...
examples/refraction-effect/refraction-effect-example.cpp
... ... @@ -85,17 +85,6 @@ struct Vertex
85 85 Vector3 position;
86 86 Vector3 normal;
87 87 Vector2 textureCoord;
88   -
89   - Vertex()
90   - {
91   - }
92   -
93   - Vertex(const Vector3& position, const Vector3& normal, const Vector2& textureCoord)
94   - : position(position),
95   - normal(normal),
96   - textureCoord(textureCoord)
97   - {
98   - }
99 88 };
100 89  
101 90 } // namespace
... ... @@ -334,16 +323,16 @@ private:
334 323 // make sure all the faces are front-facing
335 324 if(normal.z > 0)
336 325 {
337   - vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
338   - vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
339   - vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
  326 + vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
  327 + vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
  328 + vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
340 329 }
341 330 else
342 331 {
343 332 normal *= -1.f;
344   - vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
345   - vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
346   - vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
  333 + vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
  334 + vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
  335 + vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
347 336 }
348 337 }
349 338  
... ... @@ -386,10 +375,10 @@ private:
386 375 {
387 376 if(line[0] == 'v' && std::isspace(line[1])) // vertex
388 377 {
389   - std::istringstream iss(line.substr(2), std::istringstream::in);
  378 + std::istringstream vertexIss(line.substr(2), std::istringstream::in);
390 379 unsigned int i = 0;
391 380 Vector3 vertex;
392   - while(iss >> vertex[i++] && i < 3)
  381 + while(vertexIss >> vertex[i++] && i < 3)
393 382 ;
394 383 if(vertex.x < boundingBox[0]) boundingBox[0] = vertex.x;
395 384 if(vertex.x > boundingBox[1]) boundingBox[1] = vertex.x;
... ... @@ -413,11 +402,11 @@ private:
413 402 numOfInt++;
414 403 }
415 404  
416   - std::istringstream iss(line.substr(2), std::istringstream::in);
  405 + std::istringstream faceIss(line.substr(2), std::istringstream::in);
417 406 Dali::Vector<unsigned int> indices;
418 407 indices.Resize(numOfInt);
419 408 unsigned int i = 0;
420   - while(iss >> indices[i++] && i < numOfInt)
  409 + while(faceIss >> indices[i++] && i < numOfInt)
421 410 ;
422 411 unsigned int step = (i + 1) / 3;
423 412 faceIndices.PushBack(indices[0] - 1);
... ...
examples/scene-loader/scene-loader-example.cpp
... ... @@ -204,7 +204,7 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
204 204 {},
205 205 {},
206 206 nullptr,
207   - };
  207 + {}};
208 208 DliLoader::LoadParams loadParams{input, output};
209 209 if(!loader.LoadScene(path, loadParams))
210 210 {
... ... @@ -233,7 +233,10 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
233 233 viewProjection};
234 234 NodeDefinition::CreateParams nodeParams{
235 235 resources,
236   - xforms};
  236 + xforms,
  237 + {},
  238 + {},
  239 + {}};
237 240 Customization::Choices choices;
238 241  
239 242 Actor root = Actor::New();
... ...
examples/sparkle/sparkle-effect-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -226,10 +226,10 @@ private:
226 226  
227 227 float particleIdx = static_cast<float>(idx / 4 + 1); // count from 1
228 228 float colorIdx = colorIndex + 1.f; // count from 1
229   - vertices.push_back(Vertex(Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
230   - vertices.push_back(Vertex(Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
231   - vertices.push_back(Vertex(Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
232   - vertices.push_back(Vertex(Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
  229 + vertices.push_back(Vertex{Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
  230 + vertices.push_back(Vertex{Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
  231 + vertices.push_back(Vertex{Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
  232 + vertices.push_back(Vertex{Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
233 233  
234 234 faces.push_back(idx);
235 235 faces.push_back(idx + 1);
... ...
examples/sparkle/sparkle-effect.h
... ... @@ -201,23 +201,6 @@ const int MAXIMUM_ANIMATION_COUNT = 30;
201 201 // Geometry format used by the SparkeEffect
202 202 struct Vertex
203 203 {
204   - Vertex(const Vector2& texCoord,
205   - const Vector2& aParticlePath0,
206   - const Vector2& aParticlePath1,
207   - const Vector2& aParticlePath2,
208   - const Vector2& aParticlePath3,
209   - const Vector2& aParticlePath4,
210   - const Vector2& aParticlePath5)
211   - : aTexCoord(texCoord),
212   - aParticlePath0(aParticlePath0),
213   - aParticlePath1(aParticlePath1),
214   - aParticlePath2(aParticlePath2),
215   - aParticlePath3(aParticlePath3),
216   - aParticlePath4(aParticlePath4),
217   - aParticlePath5(aParticlePath5)
218   - {
219   - }
220   -
221 204 Vector2 aTexCoord;
222 205 Vector2 aParticlePath0;
223 206 Vector2 aParticlePath1;
... ...
examples/text-label/text-label-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -105,10 +105,10 @@ int ConvertToEven(int value)
105 105  
106 106 struct HSVColorConstraint
107 107 {
108   - HSVColorConstraint(float hue, float saturation, float value)
109   - : hue(hue),
110   - saturation(saturation),
111   - value(value)
  108 + HSVColorConstraint(float hueParam, float saturationParam, float valueParam)
  109 + : hue(hueParam),
  110 + saturation(saturationParam),
  111 + value(valueParam)
112 112 {
113 113 }
114 114  
... ...
examples/text-scrolling/text-scrolling-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -131,7 +131,7 @@ public:
131 131  
132 132 mAnimation = Animation::New(1.0f);
133 133  
134   - const Size mTargetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
  134 + const Size targetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
135 135  
136 136 // Create Desktop
137 137 Control desktop = Control::New();
... ... @@ -139,7 +139,7 @@ public:
139 139 desktop.SetProperty(Dali::Actor::Property::NAME, "desktopActor");
140 140 desktop.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
141 141 desktop.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
142   - desktop.SetProperty(Actor::Property::SIZE, mTargetActorSize);
  142 + desktop.SetProperty(Actor::Property::SIZE, targetActorSize);
143 143  
144 144 rootActor.Add(desktop); // Add desktop (content) to offscreen actor
145 145  
... ...
examples/transitions/shadow-button-impl.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -220,9 +220,10 @@ void ShadowButton::OnRelayout(const Vector2&amp; targetSize, RelayoutContainer&amp; cont
220 220  
221 221 void ShadowButton::RelayoutVisuals(const Vector2& targetSize)
222 222 {
223   - bool transitioning = false;
224   - ShadowButton::Transitions::iterator iter = mTransitions.begin();
225   - for(; iter != mTransitions.end(); ++iter)
  223 + bool transitioning = false;
  224 + for(ShadowButton::Transitions::iterator iter = mTransitions.begin();
  225 + iter != mTransitions.end();
  226 + ++iter)
226 227 {
227 228 if(iter->mPlaying == true)
228 229 {
... ... @@ -368,10 +369,10 @@ void ShadowButton::ResetVisual(
368 369 }
369 370  
370 371 // Extract transform maps out of the visual definition and store them
371   - Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
372   - if(value)
  372 + Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
  373 + if(transformValue)
373 374 {
374   - Property::Map* transformMap = value->GetMap();
  375 + Property::Map* transformMap = transformValue->GetMap();
375 376 if(transformMap)
376 377 {
377 378 ShadowButton::Transforms::iterator iter = FindTransform(index);
... ...
examples/visual-transitions/beat-control-impl.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -252,10 +252,10 @@ void BeatControl::SetProperty(BaseObject* object, Property::Index index, const P
252 252 const Property::Map* map = value.GetMap();
253 253 if(map)
254 254 {
255   - Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
256   - if(value)
  255 + Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
  256 + if(transformValue)
257 257 {
258   - Property::Map* transformMap = value->GetMap();
  258 + Property::Map* transformMap = transformValue->GetMap();
259 259 if(transformMap)
260 260 {
261 261 // We'll increment this whenever SIZE, ORIGIN or ANCHOR_POINT's are modified as we won't need to create a new visual if only these properties are used
... ...