< Summary

Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 86
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Update()100%11100%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.ColorQuant/6d79217e72af9e3af1a8a29c606732adac1e8d87/JeremyAnsel.ColorQuant/JeremyAnsel.ColorQuant/Box.cs

#LineLine coverage
 1// <copyright file="Box.cs" company="Jérémy Ansel">
 2// Copyright (c) 2014-2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8namespace JeremyAnsel.ColorQuant
 9{
 10    /// <summary>
 11    /// A box color cube.
 12    /// </summary>
 13    internal sealed class Box
 14    {
 15        /// <summary>
 16        /// The index bits.
 17        /// </summary>
 18        private const int IndexBits = 7;
 19
 20        /// <summary>
 21        /// Gets or sets the min red value, exclusive.
 22        /// </summary>
 23        public int R0;
 24
 25        /// <summary>
 26        /// Gets or sets the max red value, inclusive.
 27        /// </summary>
 28        public int R1;
 29
 30        /// <summary>
 31        /// Gets or sets the min green value, exclusive.
 32        /// </summary>
 33        public int G0;
 34
 35        /// <summary>
 36        /// Gets or sets the max green value, inclusive.
 37        /// </summary>
 38        public int G1;
 39
 40        /// <summary>
 41        /// Gets or sets the min blue value, exclusive.
 42        /// </summary>
 43        public int B0;
 44
 45        /// <summary>
 46        /// Gets or sets the max blue value, inclusive.
 47        /// </summary>
 48        public int B1;
 49
 50        /// <summary>
 51        /// Gets or sets the volume.
 52        /// </summary>
 53        public int Volume;
 54
 55        public int Index111;
 56        public int Index110;
 57        public int Index101;
 58        public int Index100;
 59        public int Index011;
 60        public int Index010;
 61        public int Index001;
 62        public int Index000;
 63
 64        public void Update()
 65        {
 510466            Volume = (R1 - R0) * (G1 - G0) * (B1 - B0);
 67
 510468            int r1 = (R1 << (IndexBits * 2)) + (R1 << (IndexBits + 1)) + R1;
 510469            int r0 = (R0 << (IndexBits * 2)) + (R0 << (IndexBits + 1)) + R0;
 510470            int g1 = (G1 << IndexBits) + G1;
 510471            int g0 = (G0 << IndexBits) + G0;
 510472            int b1 = B1;
 510473            int b0 = B0;
 74
 510475            Index111 = r1 + g1 + b1;
 510476            Index110 = r1 + g1 + b0;
 510477            Index101 = r1 + g0 + b1;
 510478            Index100 = r1 + g0 + b0;
 510479            Index011 = r0 + g1 + b1;
 510480            Index010 = r0 + g1 + b0;
 510481            Index001 = r0 + g0 + b1;
 510482            Index000 = r0 + g0 + b0;
 510483        }
 84    }
 85}
 86

Methods/Properties

Update()