8000 [Cleanup] Use named arguments in PresentationCore (#10321) · dotnet/wpf@ef4f81d · GitHub
[go: up one dir, main page]

Skip to content

Commit ef4f81d

Browse files
[Cleanup] Use named arguments in PresentationCore (#10321)
* Cleanup: Use named arguments in PresentationCore. Automated changes. Contributes to #10018 * Cleanup: Use named arguments in PresentationCore. Manual changes. Contributes to #10018
1 parent 7481b7e commit ef4f81d

File tree

84 files changed

+319
-321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+319
-321
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AnimatedTypeHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ internal static Rect InterpolateRect(Rect from, Rect to, Double progress)
130130

131131
internal static Rotation3D InterpolateRotation3D(Rotation3D from, Rotation3D to, Double progress)
132132
{
133-
return new QuaternionRotation3D(InterpolateQuaternion(from.InternalQuaternion, to.InternalQuaternion, progress, /* useShortestPath = */ true));
133+
return new QuaternionRotation3D(InterpolateQuaternion(from.InternalQuaternion, to.InternalQuaternion, progress, useShortestPath: true));
134134
}
135135

136136
internal static Single InterpolateSingle(Single from, Single to, Double progress)

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CookieHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal static void HandleWebRequest(WebRequest request)
3232
{
3333
try
3434
{
35-
string cookies = GetCookie(httpRequest.RequestUri, false/*throwIfNoCookie*/);
35+
string cookies = GetCookie(httpRequest.RequestUri, throwIfNoCookie: false);
3636
if(!string.IsNullOrEmpty(cookies))
3737
{
3838
if (httpRequest.CookieContainer == null)

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Automation/ElementUtil.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal static Visual GetNextSibling( Visual el )
7777
{
7878
return null;
7979
}
80-
return FindVisibleSibling ( parent, el, true /* Next */);
80+
return FindVisibleSibling ( parent, el, searchForwards: true);
8181
}
8282

8383
// Warning: Method is O(N). See FindVisibleSibling function for more information.
@@ -92,7 +92,7 @@ internal static Visual GetPreviousSibling( Visual el )
9292
return null;
9393
}
9494

95-
return FindVisibleSibling ( parent, el, false /* Previous */);
95+
return FindVisibleSibling ( parent, el, searchForwards: false);
9696
}
9797

9898
internal static Visual GetRoot( Visual el )

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/CachedFontFace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public GlyphTypeface CreateGlyphTypeface()
151151
return new GlyphTypeface(
152152
_familyCollection.GetFontUri(CachedPhysicalFace),
153153
CachedPhysicalFace->styleSimulations,
154-
/* fromPublic = */ false
154+
fromPublic: false
155155
);
156156
}
157157
}

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IListConverters.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public sealed class DoubleIListConverter : BaseIListConverter
9393
{
9494
internal sealed override object ConvertFromCore(ITypeDescriptorContext td, CultureInfo ci, string value)
9595
{
96-
_tokenizer = new TokenizerHelper(value, '\0' /* quote char */, DelimiterChar);
96+
_tokenizer = new TokenizerHelper(value, quoteChar: '\0', DelimiterChar);
9797

9898
// Estimate the output list's capacity from length of the input string.
9999
List<double> list = new List<double>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
@@ -138,7 +138,7 @@ public sealed class UShortIListConverter : BaseIListConverter
138138
{
139139
internal override object ConvertFromCore(ITypeDescriptorContext td, CultureInfo ci, string value)
140140
{
141-
_tokenizer = new TokenizerHelper(value, '\0' /* quote char */, DelimiterChar);
141+
_tokenizer = new TokenizerHelper(value, quoteChar: '\0', DelimiterChar);
142142
List<ushort> list = new List<ushort>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
143143
while (_tokenizer.NextToken())
144144
{
@@ -179,7 +179,7 @@ public sealed class BoolIListConverter : BaseIListConverter
179179
{
180180
internal override object ConvertFromCore(ITypeDescriptorContext td, CultureInfo ci, string value)
181181
{
182-
_tokenizer = new TokenizerHelper(value, '\0' /* quote char */, DelimiterChar);
182+
_tokenizer = new TokenizerHelper(value, quoteChar: '\0', DelimiterChar);
183183
List<bool> list = new List<bool>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
184184
while (_tokenizer.NextToken())
185185
{
@@ -220,7 +220,7 @@ public sealed class PointIListConverter : BaseIListConverter
220220
{
221221
internal override object ConvertFromCore(ITypeDescriptorContext td, CultureInfo ci, string value)
222222
{
223-
_tokenizer = new TokenizerHelper(value, '\0' /* quote char */, DelimiterChar);
223+
_tokenizer = new TokenizerHelper(value, quoteChar: '\0', DelimiterChar);
224224

225225
List<Point> list = new List<Point>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
226226
while (_tokenizer.NextToken())

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Lasso.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ protected override bool Filter(Point point)
729729
// points[i-1] should be removed
730730
if (i > 0)
731731
{
732-
points.RemoveRange(0, i /*count*/); // Remove points[0] to points[i-1]
732+
points.RemoveRange(0, count: i); // Remove points[0] to points[i-1]
733733
IsIncrementalLassoDirty = true;
734734
}
735735

@@ -786,10 +786,12 @@ private bool GetIntersectionWithExistingLasso(Point point, ref double bIndex)
786786
continue;
787787
}
788788

789-
double s = FindIntersection(points[count-1] - points[i], /*hitBegin*/
790-
point - points[i], /*hitEnd*/
791-
new Vector(0, 0), /*orgBegin*/
792-
points[i+1] - points[i] /*orgEnd*/);
789+
double s = FindIntersection(
790+
hitBegin: points[count-1] - points[i],
791+
hitEnd: point - points[i],
792+
orgBegin: new Vector(0, 0),
793+
orgEnd: points[i+1] - points[i]);
794+
793795
if (s >=0 && s <= 1)
794796
{
795797
// Intersection found, adjust the fIndex

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Renderer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ internal StrokeCollection Strokes
256256
StartListeningOnStrokeEvents(visual.Stroke);
257257

258258
// Attach it to the visual tree
259-
AttachVisual(visual, true/*buildingStrokeCollection*/);
259+
AttachVisual(visual, buildingStrokeCollection: true);
260260
}
261261

262262
// Start listening on events from the stroke collection.
@@ -445,7 +445,7 @@ private void OnStrokesChanged(object sender, StrokeCollectionChangedEventArgs ev
445445
StartListeningOnStrokeEvents(visual.Stroke);
446446

447447
// Attach it to the visual tree
448-
AttachVisual(visual, false/*buildingStrokeCollection*/);
448+
AttachVisual(visual, buildingStrokeCollection: false);
449449
}
450450

451451
// Deal with removed strokes first
@@ -492,7 +492,7 @@ private void OnStrokeInvalidated(object sender, EventArgs eventArgs)
492492
{
493493
// The change requires reparenting the visual in the tree.
494494
DetachVisual(visual);
495-
AttachVisual(visual, false/*buildingStrokeCollection*/);
495+
AttachVisual(visual, buildingStrokeCollection: false);
496496

497497
// Update the cached values
498498
visual.CachedIsHighlighter = stroke.DrawingAttributes.IsHighlighter;

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeNodeEnumerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ internal StrokeNode this[int index]
216216
}
217217

218218
//we use previousIndex+1 because index can skip ahead
219-
return new StrokeNode(_operations, previousIndex + 1, nodeData, lastNodeData, index == _stylusPoints.Count - 1 /*Is this the last node?*/);
219+
return new StrokeNode(_operations, previousIndex + 1, nodeData, lastNodeData, isLastNode: index == _stylusPoints.Count - 1);
220220
}
221221
}
222222

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeRenderer.cs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ internal static void CalcGeometryAndBoundsWithTransform(StrokeNodeIterator itera
122122
//insert a stroke node for the previous node
123123
strokeNodePoints.Clear();
124124
strokeNode.GetPreviousContourPoints(strokeNodePoints);
125-
AddFigureToStreamGeometryContext(context, strokeNodePoints, strokeNode.IsEllipse/*isBezierFigure*/);
125+
AddFigureToStreamGeometryContext(context, strokeNodePoints, isBezierFigure: strokeNode.IsEllipse);
126126

127127
previousPreviousNodeRendered = true;
128128
}
129129

130130
//render the stroke node
131131
strokeNodePoints.Clear();
132132
strokeNode.GetContourPoints(strokeNodePoints);
133-
AddFigureToStreamGeometryContext(context, strokeNodePoints, strokeNode.IsEllipse/*isBezierFigure*/);
133+
AddFigureToStreamGeometryContext(context, strokeNodePoints, isBezierFigure: strokeNode.IsEllipse);
134134
}
135135

136136
if (!directionChanged)
@@ -176,7 +176,7 @@ internal static void CalcGeometryAndBoundsWithTransform(StrokeNodeIterator itera
176176
}
177177

178178
//now render away!
179-
AddFigureToStreamGeometryContext(context, connectingQuadPoints, false/*isBezierFigure*/);
179+
AddFigureToStreamGeometryContext(context, connectingQuadPoints, isBezierFigure: false);
180180
}
181181
}
182182
}
@@ -490,7 +490,7 @@ internal static void CalcGeometryAndBounds(StrokeNodeIterator iterator,
490490
{
491491
//render a complete first stroke node or we can get artifacts
492492
prevPrevStrokeNode.GetContourPoints(polyLinePoints);
493-
AddFigureToStreamGeometryContext(context, polyLinePoints, prevPrevStrokeNode.IsEllipse/*isBezierFigure*/);
493+
AddFigureToStreamGeometryContext(context, polyLinePoints, isBezierFigure: prevPrevStrokeNode.IsEllipse);
494494
polyLinePoints.Clear();
495495
}
496496

@@ -565,7 +565,7 @@ internal static void CalcGeometryAndBounds(StrokeNodeIterator iterator,
565565
{
566566
//render a complete stroke node or we can get artifacts
567567
prevStrokeNode.GetContourPoints(polyLinePoints);
568-
AddFigureToStreamGeometryContext(context, polyLinePoints, prevStrokeNode.IsEllipse/*isBezierFigure*/);
568+
AddFigureToStreamGeometryContext(context, polyLinePoints, isBezierFigure: prevStrokeNode.IsEllipse);
569569
polyLinePoints.Clear();
570570
}
571571
}
@@ -672,7 +672,7 @@ internal static void CalcGeometryAndBounds(StrokeNodeIterator iterator,
672672
// we only have a single point to render
673673
Debug.Assert(pathFigureABSide.Count == 0);
674674
prevPrevStrokeNode.GetContourPoints(pathFigureABSide);
675-
AddFigureToStreamGeometryContext(context, pathFigureABSide, prevPrevStrokeNode.IsEllipse/*isBezierFigure*/);
675+
AddFigureToStreamGeometryContext(context, pathFigureABSide, isBezierFigure: prevPrevStrokeNode.IsEllipse);
676676
}
677677
}
678678
else if (prevStrokeNode.IsValid && strokeNode.IsValid)
@@ -700,7 +700,7 @@ internal static void CalcGeometryAndBounds(StrokeNodeIterator iterator,
700700
{
701701
//render a complete stroke node or we can get artifacts
702702
strokeNode.GetContourPoints(polyLinePoints);
703-
AddFigureToStreamGeometryContext(context, polyLinePoints, strokeNode.IsEllipse/*isBezierFigure*/);
703+
AddFigureToStreamGeometryContext(context, polyLinePoints, isBezierFigure: strokeNode.IsEllipse);
704704
}
705705
}
706706
else
@@ -763,7 +763,7 @@ bool showFeedback
763763
//we're between 100% and 70% overlapped
764764
//just render two distinct figures with a connecting quad (if needed)
765765
strokeNodePrevious.GetContourPoints(pointBuffer1);
766-
AddFigureToStreamGeometryContext(context, pointBuffer1, strokeNodePrevious.IsEllipse/*isBezierFigure*/);
766+
AddFigureToStreamGeometryContext(context, pointBuffer1, isBezierFigure: strokeNodePrevious.IsEllipse);
767767

768768
Quad quad = strokeNodeCurrent.GetConnectingQuad();
769769
if (!quad.IsEmpty)
@@ -772,11 +772,11 @@ bool showFeedback
772772
pointBuffer3.Add(quad.B);
773773
pointBuffer3.Add(quad.C);
774774
pointBuffer3.Add(quad.D);
775-
AddFigureToStreamGeometryContext(context, pointBuffer3, false/*isBezierFigure*/);
775+
AddFigureToStreamGeometryContext(context, pointBuffer3, isBezierFigure: false);
776776
}
777777

778778
strokeNodeCurrent.GetContourPoints(pointBuffer2);
779-
AddFigureToStreamGeometryContext(context, pointBuffer2, strokeNodeCurrent.IsEllipse/*isBezierFigure*/);
779+
AddFigureToStreamGeometryContext(context, pointBuffer2, isBezierFigure: strokeNodeCurrent.IsEllipse);
780780
}
781781
else
782782
{
@@ -867,21 +867,21 @@ private static void AddFigureToStreamGeometryContext(StreamGeometryContext conte
867867
Debug.Assert(points != null);
868868
Debug.Assert(points.Count > 0);
869869

870-
context.BeginFigure(points[points.Count - 1], //start point
871-
true, //isFilled
872-
true); //IsClosed
870+
context.BeginFigure(startPoint: points[points.Count - 1],
871+
isFilled: true,
872+
isClosed: true);
873873

874874
if (isBezierFigure)
875875
{
876876
context.PolyBezierTo(points,
877-
true, //isStroked
878-
true); //isSmoothJoin
877+
isStroked: true,
878+
isSmoothJoin: true);
879879
}
880880
else
881881
{
882882
context.PolyLineTo(points,
883-
true, //isStroked
884-
true); //isSmoothJoin
883+
isStroked: true,
884+
isSmoothJoin: true);
885885
}
886886
}
887887

@@ -895,18 +895,18 @@ private static void AddPolylineFigureToStreamGeometryContext(StreamGeometryConte
895895
Debug.Assert(abPoints != null && dcPoints != null);
896896
Debug.Assert(abPoints.Count > 0 && dcPoints.Count > 0);
897897

898-
context.BeginFigure(abPoints[0], //start point
899-
true, //isFilled
900-
true); //IsClosed
898+
context.BeginFigure(startPoint: abPoints[0],
899+
isFilled: true,
900+
isClosed: true);
901901

902902
context.PolyLineTo(abPoints,
903-
true, //isStroked
904-
true); //isSmoothJoin
903+
isStroked: true,
904+
isSmoothJoin: true);
905905

906906
context.PolyLineTo(dcPoints,
907-
true, //isStroked
908-
true); //isSmoothJoin
909-
}
907+
isStroked: true,
908+
isSmoothJoin: true);
909+
}
910910

911911
/// <summary>
912912
/// Private helper to render a path figure to the SGC
@@ -922,9 +922,9 @@ private static void AddArcToFigureToStreamGeometryContext(StreamGeometryContext
922922
return;
923923
}
924924

925-
context.BeginFigure(abPoints[0], //start point
926-
true, //isFilled
927-
true); //IsClosed
925+
context.BeginFigure(startPoint: abPoints[0],
926+
isFilled: true,
927+
isClosed: true);
928928

929929
for (int j = 0; j < 2; j++)
930930
{
@@ -938,28 +938,28 @@ private static void AddArcToFigureToStreamGeometryContext(StreamGeometryContext
938938
if (polyLinePoints.Count > 0)
939939
{
940940
//polyline first
941-
context.PolyLineTo( polyLinePoints,
942-
true, //isStroked
943-
true); //isSmoothJoin
941+
context.PolyLineTo(polyLinePoints,
942+
isStroked: true,
943+
isSmoothJoin: true);
944944
polyLinePoints.Clear();
945945
}
946946
//we're arcing, pull out height, width and the arc to point
947947
Debug.Assert(i + 2 < points.Count);
948948
if (i + 2 < points.Count)
949949
{
950950
Point sizePoint = points[i + 1];
951-
Size ellipseSize = new Size(sizePoint.X / 2/*width*/, sizePoint.Y / 2/*height*/);
951+
Size ellipseSize = new Size(width: sizePoint.X / 2, height: sizePoint.Y / 2);
952952
Point arcToPoint = points[i + 2];
953953

954954
bool isLargeArc = false; //>= 180
955955

956-
context.ArcTo( arcToPoint,
957-
ellipseSize,
958-
0d, //rotation
959-
isLargeArc, //isLargeArc
960-
SweepDirection.Clockwise,
961-
true, //isStroked
962-
true); //isSmoothJoin
956+
context.ArcTo(arcToPoint,
957+
ellipseSize,
958+
rotationAngle: 0d,
959+
isLargeArc: isLargeArc,
960+
SweepDirection.Clockwise,
961+
isStroked: true,
962+
isSmoothJoin: true);
963963
}
964964
i += 3; //advance past this arcTo block
965965
}
@@ -974,8 +974,8 @@ private static void AddArcToFigureToStreamGeometryContext(StreamGeometryContext
974974
{
975975
//polyline
976976
context.PolyLineTo(polyLinePoints,
977-
true, //isStroked
978-
true); //isSmoothJoin
977+
isStroked: true,
978+
isSmoothJoin: true);
979979
polyLinePoints.Clear();
980980
}
981981
}

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Media/VisualTreeUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ internal static PointHitTestResult AsNearestPointHitTestResult(HitTestResult res
186186
/// </summary>
187187
internal static void EnsureNonNullVisual(DependencyObject element)
188188
{
189-
EnsureVisual(element, /* allowNull = */ false);
189+
EnsureVisual(element, allowNull: false);
190190
}
191191

192192
/// <summary>
@@ -195,7 +195,7 @@ internal static void EnsureNonNullVisual(DependencyObject element)
195195
/// </summary>
196196
internal static void EnsureVisual(DependencyObject element)
197197
{
198-
EnsureVisual(element, /* allowNull = */ true);
198+
EnsureVisual(element, allowNull: true);
199199
}
200200

201201
/// <summary>

0 commit comments

Comments
 (0)
0