Skip to content

Commit

Permalink
Move property to base.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants committed Nov 18, 2020
1 parent f23fd09 commit 8a065ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public partial class A8_OperationsTests : PixelOperationsTests<A8>
public A8_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = A8.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<A8> Operations => A8.PixelOperations.Instance;
Expand All @@ -40,8 +38,6 @@ public partial class Argb32_OperationsTests : PixelOperationsTests<Argb32>
public Argb32_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Argb32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Argb32> Operations => Argb32.PixelOperations.Instance;
Expand All @@ -62,8 +58,6 @@ public partial class Bgr24_OperationsTests : PixelOperationsTests<Bgr24>
public Bgr24_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Bgr24.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Bgr24> Operations => Bgr24.PixelOperations.Instance;
Expand All @@ -84,8 +78,6 @@ public partial class Bgr565_OperationsTests : PixelOperationsTests<Bgr565>
public Bgr565_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Bgr565.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Bgr565> Operations => Bgr565.PixelOperations.Instance;
Expand All @@ -106,8 +98,6 @@ public partial class Bgra32_OperationsTests : PixelOperationsTests<Bgra32>
public Bgra32_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Bgra32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Bgra32> Operations => Bgra32.PixelOperations.Instance;
Expand All @@ -128,8 +118,6 @@ public partial class Bgra4444_OperationsTests : PixelOperationsTests<Bgra4444>
public Bgra4444_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Bgra4444.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Bgra4444> Operations => Bgra4444.PixelOperations.Instance;
Expand All @@ -150,8 +138,6 @@ public partial class Bgra5551_OperationsTests : PixelOperationsTests<Bgra5551>
public Bgra5551_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Bgra5551.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Bgra5551> Operations => Bgra5551.PixelOperations.Instance;
Expand All @@ -172,8 +158,6 @@ public partial class Byte4_OperationsTests : PixelOperationsTests<Byte4>
public Byte4_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Byte4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Byte4> Operations => Byte4.PixelOperations.Instance;
Expand All @@ -194,8 +178,6 @@ public partial class HalfSingle_OperationsTests : PixelOperationsTests<HalfSingl
public HalfSingle_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = HalfSingle.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<HalfSingle> Operations => HalfSingle.PixelOperations.Instance;
Expand All @@ -216,8 +198,6 @@ public partial class HalfVector2_OperationsTests : PixelOperationsTests<HalfVect
public HalfVector2_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = HalfVector2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<HalfVector2> Operations => HalfVector2.PixelOperations.Instance;
Expand All @@ -238,8 +218,6 @@ public partial class HalfVector4_OperationsTests : PixelOperationsTests<HalfVect
public HalfVector4_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = HalfVector4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<HalfVector4> Operations => HalfVector4.PixelOperations.Instance;
Expand All @@ -260,8 +238,6 @@ public partial class L16_OperationsTests : PixelOperationsTests<L16>
public L16_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = L16.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<L16> Operations => L16.PixelOperations.Instance;
Expand All @@ -282,8 +258,6 @@ public partial class L8_OperationsTests : PixelOperationsTests<L8>
public L8_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = L8.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<L8> Operations => L8.PixelOperations.Instance;
Expand All @@ -304,8 +278,6 @@ public partial class La16_OperationsTests : PixelOperationsTests<La16>
public La16_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = La16.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<La16> Operations => La16.PixelOperations.Instance;
Expand All @@ -326,8 +298,6 @@ public partial class La32_OperationsTests : PixelOperationsTests<La32>
public La32_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = La32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<La32> Operations => La32.PixelOperations.Instance;
Expand All @@ -348,8 +318,6 @@ public partial class NormalizedByte2_OperationsTests : PixelOperationsTests<Norm
public NormalizedByte2_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = NormalizedByte2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<NormalizedByte2> Operations => NormalizedByte2.PixelOperations.Instance;
Expand All @@ -370,8 +338,6 @@ public partial class NormalizedByte4_OperationsTests : PixelOperationsTests<Norm
public NormalizedByte4_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = NormalizedByte4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<NormalizedByte4> Operations => NormalizedByte4.PixelOperations.Instance;
Expand All @@ -392,8 +358,6 @@ public partial class NormalizedShort2_OperationsTests : PixelOperationsTests<Nor
public NormalizedShort2_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = NormalizedShort2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<NormalizedShort2> Operations => NormalizedShort2.PixelOperations.Instance;
Expand All @@ -414,8 +378,6 @@ public partial class NormalizedShort4_OperationsTests : PixelOperationsTests<Nor
public NormalizedShort4_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = NormalizedShort4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<NormalizedShort4> Operations => NormalizedShort4.PixelOperations.Instance;
Expand All @@ -436,8 +398,6 @@ public partial class Rg32_OperationsTests : PixelOperationsTests<Rg32>
public Rg32_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rg32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rg32> Operations => Rg32.PixelOperations.Instance;
Expand All @@ -458,8 +418,6 @@ public partial class Rgb24_OperationsTests : PixelOperationsTests<Rgb24>
public Rgb24_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rgb24.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rgb24> Operations => Rgb24.PixelOperations.Instance;
Expand All @@ -480,8 +438,6 @@ public partial class Rgb48_OperationsTests : PixelOperationsTests<Rgb48>
public Rgb48_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rgb48.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rgb48> Operations => Rgb48.PixelOperations.Instance;
Expand All @@ -502,8 +458,6 @@ public partial class Rgba1010102_OperationsTests : PixelOperationsTests<Rgba1010
public Rgba1010102_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rgba1010102.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rgba1010102> Operations => Rgba1010102.PixelOperations.Instance;
Expand All @@ -524,8 +478,6 @@ public partial class Rgba32_OperationsTests : PixelOperationsTests<Rgba32>
public Rgba32_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rgba32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rgba32> Operations => Rgba32.PixelOperations.Instance;
Expand All @@ -546,8 +498,6 @@ public partial class Rgba64_OperationsTests : PixelOperationsTests<Rgba64>
public Rgba64_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Rgba64.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Rgba64> Operations => Rgba64.PixelOperations.Instance;
Expand All @@ -568,8 +518,6 @@ public partial class RgbaVector_OperationsTests : PixelOperationsTests<RgbaVecto
public RgbaVector_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = RgbaVector.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<RgbaVector> Operations => RgbaVector.PixelOperations.Instance;
Expand All @@ -590,8 +538,6 @@ public partial class Short2_OperationsTests : PixelOperationsTests<Short2>
public Short2_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Short2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Short2> Operations => Short2.PixelOperations.Instance;
Expand All @@ -612,8 +558,6 @@ public partial class Short4_OperationsTests : PixelOperationsTests<Short4>
public Short4_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = Short4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<Short4> Operations => Short4.PixelOperations.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ using Xunit.Abstractions;
public <#=pixelType#>_OperationsTests(ITestOutputHelper output)
: base(output)
{
var alphaRepresentation = <#=pixelType#>.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation;
this.HasUnassociatedAlpha = alphaRepresentation == PixelAlphaRepresentation.Unassociated;
}

protected override PixelOperations<<#=pixelType#>> Operations => <#=pixelType#>.PixelOperations.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public abstract class PixelOperationsTests<TPixel> : MeasureFixture
null;
#endif

protected bool HasUnassociatedAlpha { get; set; } = true;

protected PixelOperationsTests(ITestOutputHelper output)
: base(output)
{
Expand Down Expand Up @@ -73,7 +71,9 @@ protected PixelOperationsTests(ITestOutputHelper output)

protected Configuration Configuration => Configuration.Default;

protected virtual PixelOperations<TPixel> Operations => PixelOperations<TPixel>.Instance;
protected virtual PixelOperations<TPixel> Operations { get; } = PixelOperations<TPixel>.Instance;

protected bool HasUnassociatedAlpha => this.Operations.GetPixelTypeInfo().AlphaRepresentation == PixelAlphaRepresentation.Unassociated;

internal static TPixel[] CreateExpectedPixelData(Vector4[] source, RefAction<Vector4> vectorModifier = null)
{
Expand Down Expand Up @@ -217,8 +217,7 @@ void ExpectedAction(ref Vector4 v)
expected,
(s, d) =>
{
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha
? PixelConversionModifiers.Premultiply
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha ? PixelConversionModifiers.Premultiply
: PixelConversionModifiers.None;

this.Operations.FromVector4Destructive(this.Configuration, s, d.GetSpan(), modifiers);
Expand Down Expand Up @@ -253,8 +252,7 @@ void ExpectedAction(ref Vector4 v)
expected,
(s, d) =>
{
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha
? PixelConversionModifiers.Premultiply
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha ? PixelConversionModifiers.Premultiply
: PixelConversionModifiers.None;

this.Operations.FromVector4Destructive(
Expand Down Expand Up @@ -297,8 +295,7 @@ void ExpectedAction(ref Vector4 v)
expected,
(s, d) =>
{
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha
? PixelConversionModifiers.Premultiply
PixelConversionModifiers modifiers = this.HasUnassociatedAlpha ? PixelConversionModifiers.Premultiply
: PixelConversionModifiers.None;

this.Operations.FromVector4Destructive(
Expand Down

0 comments on commit 8a065ac

Please sign in to comment.