< Summary

Class:GDX.Jobs.ParallelFor.ColorCompareJob
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Jobs/ParallelFor/ColorCompareJob.cs
Covered lines:0
Uncovered lines:13
Coverable lines:13
Total lines:51
Line coverage:0% (0 of 13)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:1
Method coverage:0% (0 of 1)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Execute(...)0%6200%

File(s)

./Packages/com.dotbunny.gdx/GDX/Jobs/ParallelFor/ColorCompareJob.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using Unity.Burst;
 6using Unity.Collections;
 7using Unity.Jobs;
 8using UnityEngine;
 9
 10namespace GDX.Jobs.ParallelFor
 11{
 12    [BurstCompile]
 13    public struct ColorCompareJob : IJobParallelFor
 14    {
 15        /// <summary>
 16        ///     The left-hand side <see cref="Unity.Collections.NativeArray{T}" /> typed as <see cref="byte" />.
 17        /// </summary>
 18        [ReadOnly] public NativeArray<Color> A;
 19
 20        /// <summary>
 21        ///     The right-hand side <see cref="Unity.Collections.NativeArray{T}" /> typed as <see cref="byte" />.
 22        /// </summary>
 23        [ReadOnly] public NativeArray<Color> B;
 24
 25        /// <summary>
 26        ///     The percent difference between the two values.
 27        /// </summary>
 28        [WriteOnly] public NativeArray<float> Percentage;
 29
 30        /// <summary>
 31        ///     Executable work for the provided index.
 32        /// </summary>
 33        /// <param name="index">The index of the Parallel for loop at which to perform work.</param>
 34        public void Execute(int index)
 035        {
 036            if (A[index] == B[index])
 037            {
 038                Percentage[index] = 1f;
 039            }
 40            else
 041            {
 042                float rDiff = A[index].r - B[index].r;
 043                float gDiff = A[index].g - B[index].g;
 044                float bDiff = A[index].b - B[index].b;
 045                float aDiff = A[index].a - B[index].a;
 46
 047                Percentage[index] = 1f - (rDiff + gDiff + bDiff + aDiff) / 4f;
 048            }
 049        }
 50    }
 51}

Methods/Properties

Execute(System.Int32)