< Summary

Class:DCL.SettingsCommon.SettingsControllers.SpecificControllers.AntiAliasingControlController
Assembly:SettingsControllers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/AntiAliasingControlController.cs
Covered lines:14
Uncovered lines:1
Coverable lines:15
Total lines:50
Line coverage:93.3% (14 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize()0%220100%
GetStoredValue()0%220100%
UpdateSetting(...)0%3.013088.89%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/SettingsControllers/SpecificControllers/AntiAliasingControlController.cs

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2using UnityEngine;
 3using UnityEngine.Rendering;
 4using UnityEngine.Rendering.Universal;
 5
 6namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers
 7{
 8
 9    [CreateAssetMenu(menuName = "Settings/Controllers/Controls/AntiAliasing", fileName = "AntiAliasingControlController"
 10    public class AntiAliasingControlController : SliderSettingsControlController
 11    {
 12        public const string TEXT_OFF = "OFF";
 13
 14        private UniversalRenderPipelineAsset lightweightRenderPipelineAsset = null;
 15
 16        public override void Initialize()
 17        {
 218            base.Initialize();
 19
 220            if (lightweightRenderPipelineAsset == null)
 221                lightweightRenderPipelineAsset = GraphicsSettings.renderPipelineAsset as UniversalRenderPipelineAsset;
 222        }
 23
 24        public override object GetStoredValue()
 25        {
 226            float antiAliasingValue =
 27                currentQualitySetting.antiAliasing == MsaaQuality.Disabled
 28                    ? 0
 29                    : ((int)currentQualitySetting.antiAliasing >> 2) + 1;
 30
 231            return antiAliasingValue;
 32        }
 33
 34        public override void UpdateSetting(object newValue)
 35        {
 236            float newFloatValue = (float)newValue;
 37
 238            int antiAliasingValue = 1 << (int)newFloatValue;
 239            currentQualitySetting.antiAliasing = (MsaaQuality)antiAliasingValue;
 40
 241            if (lightweightRenderPipelineAsset != null)
 242                lightweightRenderPipelineAsset.msaaSampleCount = antiAliasingValue;
 43
 244            if (newFloatValue == 0)
 045                RaiseOnIndicatorLabelChange(TEXT_OFF);
 46            else
 247                RaiseOnIndicatorLabelChange(antiAliasingValue.ToString("0x"));
 248        }
 49    }
 50}