Revert "[NUI] Modify CA2000 warnings for Visual"
authorJiyun Yang <ji.yang@samsung.com>
Thu, 24 Dec 2020 03:02:53 +0000 (12:02 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 11 Jan 2021 05:49:43 +0000 (14:49 +0900)
This reverts commit afa5fef90e7c8b370fc0e505d2420a7a87083344.

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 27c6985..7c2f82b 100755 (executable)
@@ -659,49 +659,24 @@ namespace Tizen.NUI
             {
                 _outputVisualMap = new PropertyMap();
             }
-            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();
+
+            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)); }
         }
 
         private void ComposingTransformMap()
         {
             _visualTransformMap = new PropertyMap();
-            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();
+            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)); }
         }
 
 
index 9ff4335..beb8907 100755 (executable)
@@ -165,13 +165,10 @@ namespace Tizen.NUI
             if (_urls != null)
             {
                 _outputVisualMap = new PropertyMap();
-                PropertyValue animatedImage = new PropertyValue((int)Visual.Type.AnimatedImage);
-                _outputVisualMap.Add(Visual.Property.Type, animatedImage);
+                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
                 if (_urls.Count == 1)
                 {
-                    PropertyValue urls = new PropertyValue(_urls[0]);
-                    _outputVisualMap.Add(ImageVisualProperty.URL, urls);
-                    urls.Dispose();
+                    _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
                 }
                 else
                 {
@@ -180,25 +177,12 @@ namespace Tizen.NUI
                     {
                         urlArray.Add(new PropertyValue(url));
                     }
-                    PropertyValue urlA = new PropertyValue(urlArray);
-                    _outputVisualMap.Add(ImageVisualProperty.URL, urlA);
-                    urlA.Dispose();
-                    urlArray.Dispose();
+                    _outputVisualMap.Add(ImageVisualProperty.URL, (new PropertyValue(urlArray)));
                 }
-                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();
+                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)); }
                 base.ComposingPropertyMap();
             }
         }
index 587a71b..7506ae2 100755 (executable)
@@ -141,22 +141,12 @@ namespace Tizen.NUI
             _outputVisualMap = null;
 
             base.ComposingPropertyMap();
-            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();
+
+            _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));
         }
 
         #endregion Methods
index 8cf2cca..5500f24 100755 (executable)
@@ -99,20 +99,11 @@ namespace Tizen.NUI
             if (_color != null && _size != null)
             {
                 _outputVisualMap = new PropertyMap();
-                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); }
+                _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)); }
                 base.ComposingPropertyMap();
-
-                border.Dispose();
-                size.Dispose();
-                color.Dispose();
-                antiAliasing.Dispose();
             }
         }
     }
index a386800..bacde98 100755 (executable)
@@ -84,12 +84,8 @@ namespace Tizen.NUI
 
                 base.ComposingPropertyMap();
 
-                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();
+                _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
+                _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(color));
             }
             else
             {
index a18efb4..f4537c4 100755 (executable)
@@ -199,37 +199,16 @@ namespace Tizen.NUI
             if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
             {
                 _outputVisualMap = new PropertyMap();
-                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); }
+                _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)); }
                 base.ComposingPropertyMap();
-
-                gradient.Dispose();
-                stopColor.Dispose();
-                startPosition.Dispose();
-                endPosition.Dispose();
-                center.Dispose();
-                radius.Dispose();
-                stopOffset.Dispose();
-                units.Dispose();
-                spreadMethod.Dispose();
             }
         }
     }
index d638af4..99e7834 100755 (executable)
@@ -142,17 +142,13 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void ComposingPropertyMap()
         {
-            PropertyMap animator = new PropertyMap();
-            PropertyValue alphaFuc = new PropertyValue(_alphaFunction);
-            animator.Add("alphaFunction", alphaFuc);
+            PropertyMap _animator = new PropertyMap();
+            _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
 
-            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);
+            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));
 
             StringBuilder sb = new StringBuilder(_propertyIndex);
             sb[0] = (char)(sb[0] | 0x20);
@@ -160,26 +156,13 @@ namespace Tizen.NUI
 
             PropertyValue val = PropertyValue.CreateFromObject(_destinationValue);
 
-            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);
+            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));
 
-            _outputVisualMap = transition;
-            alphaFuc.Dispose();
-            timeValue.Dispose();
-            timeStart.Dispose();
-            timePer.Dispose();
-            timePeriod.Dispose();
-            val.Dispose();
-            targetV.Dispose();
-            targetStr.Dispose();
-            targetAnimator.Dispose();
-            animator.Dispose();
+            _outputVisualMap = _transition;
             base.ComposingPropertyMap();
         }
     }