[NUI] Modify CA2000 warnings for Visual
authorzhouleonlei <zhouleon.lei@samsung.com>
Wed, 23 Dec 2020 07:55:21 +0000 (15:55 +0800)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 11 Jan 2021 05:49:43 +0000 (14:49 +0900)
src/Tizen.NUI/src/public/VisualMaps.cs
src/Tizen.NUI/src/public/Visuals/AnimatedImageVisual.cs
src/Tizen.NUI/src/public/Visuals/ArcVisual.cs
src/Tizen.NUI/src/public/Visuals/BorderVisual.cs
src/Tizen.NUI/src/public/Visuals/ColorVisual.cs
src/Tizen.NUI/src/public/Visuals/GradientVisual.cs
src/Tizen.NUI/src/public/Visuals/VisualAnimator.cs

index 7c2f82b..27c6985 100755 (executable)
@@ -659,24 +659,49 @@ namespace Tizen.NUI
             {
                 _outputVisualMap = new PropertyMap();
             }
-
-            if (_shader != null) { _outputVisualMap.Add(Visual.Property.Shader, new PropertyValue(_shader)); }
-            if (_premultipliedAlpha != null) { _outputVisualMap.Add(Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); }
-            if (_mixColor != null) { _outputVisualMap.Add(Visual.Property.MixColor, new PropertyValue(_mixColor)); }
-            if (_opacity != null) { _outputVisualMap.Add(Visual.Property.Opacity, new PropertyValue((float)_opacity)); }
-            if (_visualFittingMode != null) { _outputVisualMap.Add(Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode)); }
-            if (cornerRadius != null) { _outputVisualMap.Add(Visual.Property.CornerRadius, new PropertyValue((int)cornerRadius)); }
+            PropertyValue shader = new PropertyValue(_shader);
+            PropertyValue premultipliedAlpha = new PropertyValue((bool)_premultipliedAlpha);
+            PropertyValue mixColor = new PropertyValue(_mixColor);
+            PropertyValue opacity = new PropertyValue((float)_opacity);
+            PropertyValue visualFittingMode = new PropertyValue((int)_visualFittingMode);
+            PropertyValue cornerRa = new PropertyValue((int)cornerRadius);
+            if (_shader != null) { _outputVisualMap.Add(Visual.Property.Shader, shader); }
+            if (_premultipliedAlpha != null) { _outputVisualMap.Add(Visual.Property.PremultipliedAlpha, premultipliedAlpha); }
+            if (_mixColor != null) { _outputVisualMap.Add(Visual.Property.MixColor, mixColor); }
+            if (_opacity != null) { _outputVisualMap.Add(Visual.Property.Opacity, opacity); }
+            if (_visualFittingMode != null) { _outputVisualMap.Add(Visual.Property.VisualFittingMode, visualFittingMode); }
+            if (cornerRadius != null) { _outputVisualMap.Add(Visual.Property.CornerRadius, cornerRa); }
+
+            shader.Dispose();
+            premultipliedAlpha.Dispose();
+            mixColor.Dispose();
+            opacity.Dispose();
+            visualFittingMode.Dispose();
+            cornerRa.Dispose();
         }
 
         private void ComposingTransformMap()
         {
             _visualTransformMap = new PropertyMap();
-            if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); }
-            if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); }
-            if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); }
-            if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); }
-            if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
-            if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
+            PropertyValue visualSize = new PropertyValue(_visualSize);
+            PropertyValue visualOffset = new PropertyValue(_visualOffset);
+            PropertyValue visualOffsetPolicy = new PropertyValue(_visualOffsetPolicy);
+            PropertyValue visualSizePolicy = new PropertyValue(_visualSizePolicy);
+            PropertyValue visualOrigin = new PropertyValue((int)_visualOrigin);
+            PropertyValue visualAnchorPoint = new PropertyValue((int)_visualAnchorPoint);
+            if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, visualSize); }
+            if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, visualOffset); }
+            if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, visualOffsetPolicy); }
+            if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, visualSizePolicy); }
+            if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, visualOrigin); }
+            if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, visualAnchorPoint); }
+
+            visualSize.Dispose();
+            visualOffset.Dispose();
+            visualOffsetPolicy.Dispose();
+            visualSizePolicy.Dispose();
+            visualOrigin.Dispose();
+            visualAnchorPoint.Dispose();
         }
 
 
index beb8907..9ff4335 100755 (executable)
@@ -165,10 +165,13 @@ namespace Tizen.NUI
             if (_urls != null)
             {
                 _outputVisualMap = new PropertyMap();
-                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
+                PropertyValue animatedImage = new PropertyValue((int)Visual.Type.AnimatedImage);
+                _outputVisualMap.Add(Visual.Property.Type, animatedImage);
                 if (_urls.Count == 1)
                 {
-                    _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
+                    PropertyValue urls = new PropertyValue(_urls[0]);
+                    _outputVisualMap.Add(ImageVisualProperty.URL, urls);
+                    urls.Dispose();
                 }
                 else
                 {
@@ -177,12 +180,25 @@ namespace Tizen.NUI
                     {
                         urlArray.Add(new PropertyValue(url));
                     }
-                    _outputVisualMap.Add(ImageVisualProperty.URL, (new PropertyValue(urlArray)));
+                    PropertyValue urlA = new PropertyValue(urlArray);
+                    _outputVisualMap.Add(ImageVisualProperty.URL, urlA);
+                    urlA.Dispose();
+                    urlArray.Dispose();
                 }
-                if (_batchSize != null) { _outputVisualMap.Add(ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); }
-                if (_cacheSize != null) { _outputVisualMap.Add(ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); }
-                if (_frameDelay != null) { _outputVisualMap.Add(ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); }
-                if (_loopCount != null) { _outputVisualMap.Add(ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount)); }
+                PropertyValue batchSize = new PropertyValue((int)_batchSize);
+                PropertyValue cacheSize = new PropertyValue((int)_cacheSize);
+                PropertyValue frameDelay = new PropertyValue((float)_frameDelay);
+                PropertyValue loopCount = new PropertyValue((int)_loopCount);
+                if (_batchSize != null) { _outputVisualMap.Add(ImageVisualProperty.BatchSize, batchSize); }
+                if (_cacheSize != null) { _outputVisualMap.Add(ImageVisualProperty.CacheSize, cacheSize); }
+                if (_frameDelay != null) { _outputVisualMap.Add(ImageVisualProperty.FrameDelay, frameDelay); }
+                if (_loopCount != null) { _outputVisualMap.Add(ImageVisualProperty.LoopCount, loopCount); }
+
+                animatedImage.Dispose();
+                batchSize.Dispose();
+                cacheSize.Dispose();
+                frameDelay.Dispose();
+                loopCount.Dispose();
                 base.ComposingPropertyMap();
             }
         }
index 7506ae2..587a71b 100755 (executable)
@@ -141,12 +141,22 @@ namespace Tizen.NUI
             _outputVisualMap = null;
 
             base.ComposingPropertyMap();
-
-            _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Arc));
-            _outputVisualMap.Add(ArcVisualProperty.Thickness, new PropertyValue(Thickness < 0.0f ? 0.0f : Thickness));
-            _outputVisualMap.Add(ArcVisualProperty.StartAngle, new PropertyValue(StartAngle));
-            _outputVisualMap.Add(ArcVisualProperty.SweepAngle, new PropertyValue(SweepAngle));
-            _outputVisualMap.Add(ArcVisualProperty.Cap, new PropertyValue((int)Cap));
+            PropertyValue arc = new PropertyValue((int)Visual.Type.Arc);
+            PropertyValue thickness = new PropertyValue(Thickness < 0.0f ? 0.0f : Thickness);
+            PropertyValue startAngle = new PropertyValue(StartAngle);
+            PropertyValue sweepAngle = new PropertyValue(SweepAngle);
+            PropertyValue cap = new PropertyValue((int)Cap);
+            _outputVisualMap.Add(Visual.Property.Type, arc);
+            _outputVisualMap.Add(ArcVisualProperty.Thickness, thickness);
+            _outputVisualMap.Add(ArcVisualProperty.StartAngle, startAngle);
+            _outputVisualMap.Add(ArcVisualProperty.SweepAngle, sweepAngle);
+            _outputVisualMap.Add(ArcVisualProperty.Cap, cap);
+
+            arc.Dispose();
+            thickness.Dispose();
+            startAngle.Dispose();
+            sweepAngle.Dispose();
+            cap.Dispose();
         }
 
         #endregion Methods
index 5500f24..8cf2cca 100755 (executable)
@@ -99,11 +99,20 @@ namespace Tizen.NUI
             if (_color != null && _size != null)
             {
                 _outputVisualMap = new PropertyMap();
-                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
-                _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size));
-                _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color));
-                if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); }
+                PropertyValue border = new PropertyValue((int)Visual.Type.Border);
+                PropertyValue size = new PropertyValue((float)_size);
+                PropertyValue color = new PropertyValue(_color);
+                _outputVisualMap.Add(Visual.Property.Type, border);
+                _outputVisualMap.Add(BorderVisualProperty.Size, size);
+                _outputVisualMap.Add(BorderVisualProperty.Color, color);
+                PropertyValue antiAliasing = new PropertyValue((bool)_antiAliasing);
+                if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, antiAliasing); }
                 base.ComposingPropertyMap();
+
+                border.Dispose();
+                size.Dispose();
+                color.Dispose();
+                antiAliasing.Dispose();
             }
         }
     }
index bacde98..a386800 100755 (executable)
@@ -84,8 +84,12 @@ namespace Tizen.NUI
 
                 base.ComposingPropertyMap();
 
-                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
-                _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(color));
+                PropertyValue colorTemp = new PropertyValue((int)Visual.Type.Color);
+                _outputVisualMap.Add(Visual.Property.Type, colorTemp);
+                PropertyValue colorTemp1 = new PropertyValue(color);
+                _outputVisualMap.Add(ColorVisualProperty.MixColor, colorTemp1);
+                colorTemp.Dispose();
+                colorTemp1.Dispose();
             }
             else
             {
index f4537c4..a18efb4 100755 (executable)
@@ -199,16 +199,37 @@ namespace Tizen.NUI
             if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
             {
                 _outputVisualMap = new PropertyMap();
-                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient));
-                _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor));
-                if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); }
-                if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); }
-                if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); }
-                if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); }
-                if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); }
-                if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); }
-                if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); }
+                PropertyValue gradient = new PropertyValue((int)Visual.Type.Gradient);
+                _outputVisualMap.Add(Visual.Property.Type, gradient);
+                PropertyValue stopColor = new PropertyValue(_stopColor);
+                _outputVisualMap.Add(GradientVisualProperty.StopColor, stopColor);
+
+                PropertyValue startPosition = new PropertyValue(_startPosition);
+                PropertyValue endPosition = new PropertyValue(_endPosition);
+                PropertyValue center = new PropertyValue(_center);
+                PropertyValue radius = new PropertyValue((float)_radius);
+                PropertyValue stopOffset = new PropertyValue(_stopOffset);
+                PropertyValue units = new PropertyValue((int)_units);
+                PropertyValue spreadMethod = new PropertyValue((int)_spreadMethod);
+
+                if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, startPosition); }
+                if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, endPosition); }
+                if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, center); }
+                if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, radius); }
+                if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, stopOffset); }
+                if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, units); }
+                if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, spreadMethod); }
                 base.ComposingPropertyMap();
+
+                gradient.Dispose();
+                stopColor.Dispose();
+                startPosition.Dispose();
+                endPosition.Dispose();
+                center.Dispose();
+                radius.Dispose();
+                stopOffset.Dispose();
+                units.Dispose();
+                spreadMethod.Dispose();
             }
         }
     }
index 99e7834..d638af4 100755 (executable)
@@ -142,13 +142,17 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void ComposingPropertyMap()
         {
-            PropertyMap _animator = new PropertyMap();
-            _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
+            PropertyMap animator = new PropertyMap();
+            PropertyValue alphaFuc = new PropertyValue(_alphaFunction);
+            animator.Add("alphaFunction", alphaFuc);
 
-            PropertyMap _timePeriod = new PropertyMap();
-            _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f));
-            _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f));
-            _animator.Add("timePeriod", new PropertyValue(_timePeriod));
+            PropertyMap timePeriod = new PropertyMap();
+            PropertyValue timeValue = new PropertyValue((_endTime - _startTime) / 1000.0f);
+            timePeriod.Add("duration", timeValue);
+            PropertyValue timeStart = new PropertyValue(_startTime / 1000.0f);
+            timePeriod.Add("delay", timeStart);
+            PropertyValue timePer = new PropertyValue(timePeriod);
+            animator.Add("timePeriod", timePer);
 
             StringBuilder sb = new StringBuilder(_propertyIndex);
             sb[0] = (char)(sb[0] | 0x20);
@@ -156,13 +160,26 @@ namespace Tizen.NUI
 
             PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
 
-            PropertyMap _transition = new PropertyMap();
-            _transition.Add("target", new PropertyValue(_target));
-            _transition.Add("property", new PropertyValue(_str));
-            _transition.Add("targetValue", val);
-            _transition.Add("animator", new PropertyValue(_animator));
+            PropertyMap transition = new PropertyMap();
+            PropertyValue targetV = new PropertyValue(_target);
+            transition.Add("target", targetV);
+            PropertyValue targetStr = new PropertyValue(_str);
+            transition.Add("property", targetStr);
+            transition.Add("targetValue", val);
+            PropertyValue targetAnimator = new PropertyValue(animator);
+            transition.Add("animator", targetAnimator);
 
-            _outputVisualMap = _transition;
+            _outputVisualMap = transition;
+            alphaFuc.Dispose();
+            timeValue.Dispose();
+            timeStart.Dispose();
+            timePer.Dispose();
+            timePeriod.Dispose();
+            val.Dispose();
+            targetV.Dispose();
+            targetStr.Dispose();
+            targetAnimator.Dispose();
+            animator.Dispose();
             base.ComposingPropertyMap();
         }
     }