< Summary

Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 119
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/AlphaBox.cs

#LineLine coverage
 1// <copyright file="AlphaBox.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 with alpha.
 12    /// </summary>
 13    internal sealed class AlphaBox
 14    {
 15        /// <summary>
 16        /// The index bits.
 17        /// </summary>
 18        private const int IndexBits = 6;
 19
 20        /// <summary>
 21        /// The index alpha bits.
 22        /// </summary>
 23        private const int IndexAlphaBits = 4;
 24
 25        /// <summary>
 26        /// Gets or sets the min red value, exclusive.
 27        /// </summary>
 28        public int R0;
 29
 30        /// <summary>
 31        /// Gets or sets the max red value, inclusive.
 32        /// </summary>
 33        public int R1;
 34
 35        /// <summary>
 36        /// Gets or sets the min green value, exclusive.
 37        /// </summary>
 38        public int G0;
 39
 40        /// <summary>
 41        /// Gets or sets the max green value, inclusive.
 42        /// </summary>
 43        public int G1;
 44
 45        /// <summary>
 46        /// Gets or sets the min blue value, exclusive.
 47        /// </summary>
 48        public int B0;
 49
 50        /// <summary>
 51        /// Gets or sets the max blue value, inclusive.
 52        /// </summary>
 53        public int B1;
 54
 55        /// <summary>
 56        /// Gets or sets the min alpha value, exclusive.
 57        /// </summary>
 58        public int A0;
 59
 60        /// <summary>
 61        /// Gets or sets the max alpha value, inclusive.
 62        /// </summary>
 63        public int A1;
 64
 65        /// <summary>
 66        /// Gets or sets the volume.
 67        /// </summary>
 68        public int Volume;
 69
 70        public int Index1111;
 71        public int Index1110;
 72        public int Index1101;
 73        public int Index1100;
 74        public int Index1011;
 75        public int Index1010;
 76        public int Index1001;
 77        public int Index1000;
 78        public int Index0111;
 79        public int Index0110;
 80        public int Index0101;
 81        public int Index0100;
 82        public int Index0011;
 83        public int Index0010;
 84        public int Index0001;
 85        public int Index0000;
 86
 87        public void Update()
 88        {
 318289            Volume = (R1 - R0) * (G1 - G0) * (B1 - B0) * (A1 - A0);
 90
 318291            int r1 = (R1 << ((IndexBits * 2) + IndexAlphaBits)) + (R1 << (IndexBits + IndexAlphaBits + 1)) + (R1 << (Ind
 318292            int r0 = (R0 << ((IndexBits * 2) + IndexAlphaBits)) + (R0 << (IndexBits + IndexAlphaBits + 1)) + (R0 << (Ind
 318293            int g1 = (G1 << (IndexBits + IndexAlphaBits)) + (G1 << IndexBits) + (G1 << IndexAlphaBits) + G1;
 318294            int g0 = (G0 << (IndexBits + IndexAlphaBits)) + (G0 << IndexBits) + (G0 << IndexAlphaBits) + G0;
 318295            int b1 = (B1 << IndexAlphaBits) + B1;
 318296            int b0 = (B0 << IndexAlphaBits) + B0;
 318297            int a1 = A1;
 318298            int a0 = A0;
 99
 3182100            Index1111 = r1 + g1 + b1 + a1;
 3182101            Index1110 = r1 + g1 + b1 + a0;
 3182102            Index1101 = r1 + g1 + b0 + a1;
 3182103            Index1100 = r1 + g1 + b0 + a0;
 3182104            Index1011 = r1 + g0 + b1 + a1;
 3182105            Index1010 = r1 + g0 + b1 + a0;
 3182106            Index1001 = r1 + g0 + b0 + a1;
 3182107            Index1000 = r1 + g0 + b0 + a0;
 3182108            Index0111 = r0 + g1 + b1 + a1;
 3182109            Index0110 = r0 + g1 + b1 + a0;
 3182110            Index0101 = r0 + g1 + b0 + a1;
 3182111            Index0100 = r0 + g1 + b0 + a0;
 3182112            Index0011 = r0 + g0 + b1 + a1;
 3182113            Index0010 = r0 + g0 + b1 + a0;
 3182114            Index0001 = r0 + g0 + b0 + a1;
 3182115            Index0000 = r0 + g0 + b0 + a0;
 3182116        }
 117    }
 118}
 119

Methods/Properties

Update()