8000 Cleanup: Use named arguments in PresentationCore. · ThomasGoulet73/wpf@e206b7f · GitHub
[go: up one dir, main page]

Skip to content

Commit e206b7f

Browse files
Cleanup: Use named arguments in PresentationCore.
Manual changes. Contributes to dotnet#10018
1 parent 8208631 commit e206b7f

36 files changed

+141
-140
lines changed

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/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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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, previou 10000 sIndex + 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: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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/System/Windows/DragDrop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ int UnsafeNativeMethods.IOleDropSource.OleGiveFeedback(int effect)
670670
GiveFeedbackEventArgs args;
671671

672672
// Create GiveFeedback event arguments.
673-
args = new GiveFeedbackEventArgs((DragDropEffects)effect, /*UseDefaultCursors*/ false);
673+
args = new GiveFeedbackEventArgs((DragDropEffects)effect, useDefaultCursors: false);
674674

675675
// Raise the give feedback event for both Tunnel(Preview) and Bubble.
676676
RaiseGiveFeedbackEvent(args);

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/StrokeCollection.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected override sealed void ClearItems()
282282

283283
base.ClearItems();
284284

285-
RaiseStrokesChanged(null /*added*/, removed, -1);
285+
RaiseStrokesChanged(addedStrokes: null, removed, -1);
286286
}
287287
}
288288

@@ -296,7 +296,7 @@ protected override sealed void RemoveItem(int index)
296296

297297
StrokeCollection removed = new StrokeCollection();
298298
( (List<Stroke>)removed.Items ).Add(removedStroke);
299-
RaiseStrokesChanged(null /*added*/, removed, index);
299+
RaiseStrokesChanged(addedStrokes: null, removed, index);
300300
}
301301

302302
/// <summary>
@@ -314,7 +314,7 @@ protected override sealed void InsertItem(int index, Stroke stroke)
314314

315315
StrokeCollection addedStrokes = new StrokeCollection();
316316
( (List<Stroke>)addedStrokes.Items ).Add(stroke);
317-
RaiseStrokesChanged(addedStrokes, null /*removed*/, index);
317+
RaiseStrokesChanged(addedStrokes, removedStrokes: null, index);
318318
}
319319

320320
/// <summary>
@@ -398,7 +398,7 @@ public void Remove(StrokeCollection strokes)
398398
( (List<Stroke>)this.Items ).RemoveAt(indexes[x]);
399399
}
400400

401-
RaiseStrokesChanged(null /*added*/, strokes, indexes[0]);
401+
RaiseStrokesChanged(addedStrokes: null, strokes, indexes[0]);
402402
}
403403

404404
/// <summary>
@@ -434,7 +434,7 @@ public void Add(StrokeCollection strokes)
434434
//and call our protected List<Stroke> directly
435435
( (List<Stroke>)this.Items ).AddRange(strokes);
436436

437-
RaiseStrokesChanged(strokes, null /*removed*/, index);
437+
RaiseStrokesChanged(strokes, removedStrokes: null, index);
438438
}
439439

440440
/// <summary>

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/StrokeCollection2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public void Draw(DrawingContext context)
386386
foreach (Stroke stroke in strokes)
387387
{
388388
stroke.DrawInternal(context, StrokeRenderer.GetHighlighterAttributes(stroke, stroke.DrawingAttributes),
389-
false /*Don't draw selected stroke as hollow*/);
389+
drawAsHollow: false);
390390
}
391391
}
392392
finally
@@ -397,7 +397,7 @@ public void Draw(DrawingContext context)
397397

398398
foreach(Stroke stroke in solidStrokes)
399399
{
400-
stroke.DrawInternal(context, stroke.DrawingAttributes, false/*Don't draw selected stroke as hollow*/);
400+
stroke.DrawInternal(context, stroke.DrawingAttributes, drawAsHollow: false);
401401
}
402402
}
403403
#endregion

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/AccessKeyManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private ProcessKeyResult ProcessKey(List<IInputElement> targets, string key, boo
264264

265265
if (invokeUIElement != null)
266266
{
267-
AccessKeyEventArgs args = new AccessKeyEventArgs(key, !oneUIElement || existsElsewhere /* == isMultiple */,userInitiated);
267+
AccessKeyEventArgs args = new AccessKeyEventArgs(key, isMultiple: !oneUIElement || existsElsewhere, userInitiated);
268268
try
269269
{
270270
invokeUIElement.InvokeAccessKey(args);

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Cursor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ private void LegacyLoadFromStream(Stream cursorStream)
231231
// If the buffer is filled up, then write those bytes out and read more bytes up to BUFFERSIZE
232232
for (dataSize = cursorData.Length;
233233
dataSize >= BUFFERSIZE;
234-
dataSize = reader.Read(cursorData, 0 /*index in array*/, BUFFERSIZE /*bytes to read*/))
234+
dataSize = reader.Read(cursorData, index: 0, count: BUFFERSIZE))
235235
{
236-
fileStream.Write(cursorData, 0 /*index in array*/, BUFFERSIZE /*bytes to write*/);
236+
fileStream.Write(cursorData, offset: 0, count: BUFFERSIZE);
237237
}
238238

239239
// Write any remaining bytes
240-
fileStream.Write(cursorData, 0 /*index in array*/, dataSize /*bytes to write*/);
240+
fileStream.Write(cursorData, offset: 0, count: dataSize);
241241
}
242242
}
243243

0 commit comments

Comments
 (0)
0