Skip to content

Commit 4a55496

Browse files
SimonCroppJimBobSquarePants
authored andcommitted
fix "as" usage (#959)
1 parent 2734847 commit 4a55496

4 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/ImageSharp/Advanced/AotCompilerTools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private static void AotCompileResizeOperations<TPixel>()
181181
where TPixel : struct, IPixel<TPixel>
182182
{
183183
var resizeProcessor = new ResizeProcessor(new ResizeOptions(), default);
184-
var genericResizeProcessor = new ResizeProcessor<TPixel>(resizeProcessor.CreatePixelSpecificProcessor<TPixel>() as ResizeProcessor);
184+
var genericResizeProcessor = new ResizeProcessor<TPixel>((ResizeProcessor)resizeProcessor.CreatePixelSpecificProcessor<TPixel>());
185185
genericResizeProcessor.AotCreateDestination(new Image<TPixel>(0, 0), default);
186186
}
187187
}

src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors and contributors.
1+
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System.Numerics;
@@ -118,9 +118,9 @@ public int WriteCurveSegment(IccCurveSegment value)
118118
switch (value.Signature)
119119
{
120120
case IccCurveSegmentSignature.FormulaCurve:
121-
return count + this.WriteFormulaCurveElement(value as IccFormulaCurveElement);
121+
return count + this.WriteFormulaCurveElement((IccFormulaCurveElement)value);
122122
case IccCurveSegmentSignature.SampledCurve:
123-
return count + this.WriteSampledCurveElement(value as IccSampledCurveElement);
123+
return count + this.WriteSampledCurveElement((IccSampledCurveElement)value);
124124
default:
125125
throw new InvalidIccProfileException($"Invalid CurveSegment type of {value.Signature}");
126126
}

src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors and contributors.
1+
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

44
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
@@ -22,11 +22,11 @@ public int WriteMultiProcessElement(IccMultiProcessElement value)
2222
switch (value.Signature)
2323
{
2424
case IccMultiProcessElementSignature.CurveSet:
25-
return count + this.WriteCurveSetProcessElement(value as IccCurveSetProcessElement);
25+
return count + this.WriteCurveSetProcessElement((IccCurveSetProcessElement)value);
2626
case IccMultiProcessElementSignature.Matrix:
27-
return count + this.WriteMatrixProcessElement(value as IccMatrixProcessElement);
27+
return count + this.WriteMatrixProcessElement((IccMatrixProcessElement)value);
2828
case IccMultiProcessElementSignature.Clut:
29-
return count + this.WriteClutProcessElement(value as IccClutProcessElement);
29+
return count + this.WriteClutProcessElement((IccClutProcessElement)value);
3030

3131
case IccMultiProcessElementSignature.BAcs:
3232
case IccMultiProcessElementSignature.EAcs:

src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors and contributors.
1+
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System.Linq;
@@ -37,102 +37,102 @@ public int WriteTagDataEntry(IccTagDataEntry entry)
3737
switch (entry.Signature)
3838
{
3939
case IccTypeSignature.Chromaticity:
40-
count += this.WriteChromaticityTagDataEntry(entry as IccChromaticityTagDataEntry);
40+
count += this.WriteChromaticityTagDataEntry((IccChromaticityTagDataEntry)entry);
4141
break;
4242
case IccTypeSignature.ColorantOrder:
43-
count += this.WriteColorantOrderTagDataEntry(entry as IccColorantOrderTagDataEntry);
43+
count += this.WriteColorantOrderTagDataEntry((IccColorantOrderTagDataEntry)entry);
4444
break;
4545
case IccTypeSignature.ColorantTable:
46-
count += this.WriteColorantTableTagDataEntry(entry as IccColorantTableTagDataEntry);
46+
count += this.WriteColorantTableTagDataEntry((IccColorantTableTagDataEntry)entry);
4747
break;
4848
case IccTypeSignature.Curve:
49-
count += this.WriteCurveTagDataEntry(entry as IccCurveTagDataEntry);
49+
count += this.WriteCurveTagDataEntry((IccCurveTagDataEntry)entry);
5050
break;
5151
case IccTypeSignature.Data:
52-
count += this.WriteDataTagDataEntry(entry as IccDataTagDataEntry);
52+
count += this.WriteDataTagDataEntry((IccDataTagDataEntry)entry);
5353
break;
5454
case IccTypeSignature.DateTime:
55-
count += this.WriteDateTimeTagDataEntry(entry as IccDateTimeTagDataEntry);
55+
count += this.WriteDateTimeTagDataEntry((IccDateTimeTagDataEntry)entry);
5656
break;
5757
case IccTypeSignature.Lut16:
58-
count += this.WriteLut16TagDataEntry(entry as IccLut16TagDataEntry);
58+
count += this.WriteLut16TagDataEntry((IccLut16TagDataEntry)entry);
5959
break;
6060
case IccTypeSignature.Lut8:
61-
count += this.WriteLut8TagDataEntry(entry as IccLut8TagDataEntry);
61+
count += this.WriteLut8TagDataEntry((IccLut8TagDataEntry)entry);
6262
break;
6363
case IccTypeSignature.LutAToB:
64-
count += this.WriteLutAtoBTagDataEntry(entry as IccLutAToBTagDataEntry);
64+
count += this.WriteLutAtoBTagDataEntry((IccLutAToBTagDataEntry)entry);
6565
break;
6666
case IccTypeSignature.LutBToA:
67-
count += this.WriteLutBtoATagDataEntry(entry as IccLutBToATagDataEntry);
67+
count += this.WriteLutBtoATagDataEntry((IccLutBToATagDataEntry)entry);
6868
break;
6969
case IccTypeSignature.Measurement:
70-
count += this.WriteMeasurementTagDataEntry(entry as IccMeasurementTagDataEntry);
70+
count += this.WriteMeasurementTagDataEntry((IccMeasurementTagDataEntry)entry);
7171
break;
7272
case IccTypeSignature.MultiLocalizedUnicode:
73-
count += this.WriteMultiLocalizedUnicodeTagDataEntry(entry as IccMultiLocalizedUnicodeTagDataEntry);
73+
count += this.WriteMultiLocalizedUnicodeTagDataEntry((IccMultiLocalizedUnicodeTagDataEntry)entry);
7474
break;
7575
case IccTypeSignature.MultiProcessElements:
76-
count += this.WriteMultiProcessElementsTagDataEntry(entry as IccMultiProcessElementsTagDataEntry);
76+
count += this.WriteMultiProcessElementsTagDataEntry((IccMultiProcessElementsTagDataEntry)entry);
7777
break;
7878
case IccTypeSignature.NamedColor2:
79-
count += this.WriteNamedColor2TagDataEntry(entry as IccNamedColor2TagDataEntry);
79+
count += this.WriteNamedColor2TagDataEntry((IccNamedColor2TagDataEntry)entry);
8080
break;
8181
case IccTypeSignature.ParametricCurve:
82-
count += this.WriteParametricCurveTagDataEntry(entry as IccParametricCurveTagDataEntry);
82+
count += this.WriteParametricCurveTagDataEntry((IccParametricCurveTagDataEntry)entry);
8383
break;
8484
case IccTypeSignature.ProfileSequenceDesc:
85-
count += this.WriteProfileSequenceDescTagDataEntry(entry as IccProfileSequenceDescTagDataEntry);
85+
count += this.WriteProfileSequenceDescTagDataEntry((IccProfileSequenceDescTagDataEntry)entry);
8686
break;
8787
case IccTypeSignature.ProfileSequenceIdentifier:
88-
count += this.WriteProfileSequenceIdentifierTagDataEntry(entry as IccProfileSequenceIdentifierTagDataEntry);
88+
count += this.WriteProfileSequenceIdentifierTagDataEntry((IccProfileSequenceIdentifierTagDataEntry)entry);
8989
break;
9090
case IccTypeSignature.ResponseCurveSet16:
91-
count += this.WriteResponseCurveSet16TagDataEntry(entry as IccResponseCurveSet16TagDataEntry);
91+
count += this.WriteResponseCurveSet16TagDataEntry((IccResponseCurveSet16TagDataEntry)entry);
9292
break;
9393
case IccTypeSignature.S15Fixed16Array:
94-
count += this.WriteFix16ArrayTagDataEntry(entry as IccFix16ArrayTagDataEntry);
94+
count += this.WriteFix16ArrayTagDataEntry((IccFix16ArrayTagDataEntry)entry);
9595
break;
9696
case IccTypeSignature.Signature:
97-
count += this.WriteSignatureTagDataEntry(entry as IccSignatureTagDataEntry);
97+
count += this.WriteSignatureTagDataEntry((IccSignatureTagDataEntry)entry);
9898
break;
9999
case IccTypeSignature.Text:
100-
count += this.WriteTextTagDataEntry(entry as IccTextTagDataEntry);
100+
count += this.WriteTextTagDataEntry((IccTextTagDataEntry)entry);
101101
break;
102102
case IccTypeSignature.U16Fixed16Array:
103-
count += this.WriteUFix16ArrayTagDataEntry(entry as IccUFix16ArrayTagDataEntry);
103+
count += this.WriteUFix16ArrayTagDataEntry((IccUFix16ArrayTagDataEntry)entry);
104104
break;
105105
case IccTypeSignature.UInt16Array:
106-
count += this.WriteUInt16ArrayTagDataEntry(entry as IccUInt16ArrayTagDataEntry);
106+
count += this.WriteUInt16ArrayTagDataEntry((IccUInt16ArrayTagDataEntry)entry);
107107
break;
108108
case IccTypeSignature.UInt32Array:
109-
count += this.WriteUInt32ArrayTagDataEntry(entry as IccUInt32ArrayTagDataEntry);
109+
count += this.WriteUInt32ArrayTagDataEntry((IccUInt32ArrayTagDataEntry)entry);
110110
break;
111111
case IccTypeSignature.UInt64Array:
112-
count += this.WriteUInt64ArrayTagDataEntry(entry as IccUInt64ArrayTagDataEntry);
112+
count += this.WriteUInt64ArrayTagDataEntry((IccUInt64ArrayTagDataEntry)entry);
113113
break;
114114
case IccTypeSignature.UInt8Array:
115-
count += this.WriteUInt8ArrayTagDataEntry(entry as IccUInt8ArrayTagDataEntry);
115+
count += this.WriteUInt8ArrayTagDataEntry((IccUInt8ArrayTagDataEntry)entry);
116116
break;
117117
case IccTypeSignature.ViewingConditions:
118-
count += this.WriteViewingConditionsTagDataEntry(entry as IccViewingConditionsTagDataEntry);
118+
count += this.WriteViewingConditionsTagDataEntry((IccViewingConditionsTagDataEntry)entry);
119119
break;
120120
case IccTypeSignature.Xyz:
121-
count += this.WriteXyzTagDataEntry(entry as IccXyzTagDataEntry);
121+
count += this.WriteXyzTagDataEntry((IccXyzTagDataEntry)entry);
122122
break;
123123

124124
// V2 Types:
125125
case IccTypeSignature.TextDescription:
126-
count += this.WriteTextDescriptionTagDataEntry(entry as IccTextDescriptionTagDataEntry);
126+
count += this.WriteTextDescriptionTagDataEntry((IccTextDescriptionTagDataEntry)entry);
127127
break;
128128
case IccTypeSignature.CrdInfo:
129-
count += this.WriteCrdInfoTagDataEntry(entry as IccCrdInfoTagDataEntry);
129+
count += this.WriteCrdInfoTagDataEntry((IccCrdInfoTagDataEntry)entry);
130130
break;
131131
case IccTypeSignature.Screening:
132-
count += this.WriteScreeningTagDataEntry(entry as IccScreeningTagDataEntry);
132+
count += this.WriteScreeningTagDataEntry((IccScreeningTagDataEntry)entry);
133133
break;
134134
case IccTypeSignature.UcrBg:
135-
count += this.WriteUcrBgTagDataEntry(entry as IccUcrBgTagDataEntry);
135+
count += this.WriteUcrBgTagDataEntry((IccUcrBgTagDataEntry)entry);
136136
break;
137137

138138
// Unsupported or unknown

0 commit comments

Comments
 (0)