diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs index 1a98e0db29..11e5727ceb 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs @@ -65,6 +65,14 @@ namespace ICSharpCode.AvalonEdit.Rendering } } + /// + /// Adds a rectangle to the geometry. + /// + /// + /// This overload will align the coordinates according to + /// or . + /// Use the -overload instead if the coordinates should not be aligned. + /// public void AddRectangle(TextView textView, Rect rectangle) { AddRectangle(PixelSnapHelpers.GetPixelSize(textView), rectangle); @@ -73,15 +81,15 @@ namespace ICSharpCode.AvalonEdit.Rendering void AddRectangle(Size pixelSize, Rect r) { if (AlignToWholePixels) { - AddRectangle(PixelSnapHelpers.Round(r.Left, pixelSize.Width), - PixelSnapHelpers.Round(r.Top + 1, pixelSize.Height), - PixelSnapHelpers.Round(r.Right, pixelSize.Width), - PixelSnapHelpers.Round(r.Bottom + 1, pixelSize.Height)); + AddRectangle(PixelSnapHelpers.Round(r.Left, pixelSize.Width), + PixelSnapHelpers.Round(r.Top + 1, pixelSize.Height), + PixelSnapHelpers.Round(r.Right, pixelSize.Width), + PixelSnapHelpers.Round(r.Bottom + 1, pixelSize.Height)); } else if (AlignToMiddleOfPixels) { - AddRectangle(PixelSnapHelpers.PixelAlign(r.Left, pixelSize.Width), - PixelSnapHelpers.PixelAlign(r.Top + 1, pixelSize.Height), - PixelSnapHelpers.PixelAlign(r.Right, pixelSize.Width), - PixelSnapHelpers.PixelAlign(r.Bottom + 1, pixelSize.Height)); + AddRectangle(PixelSnapHelpers.PixelAlign(r.Left, pixelSize.Width), + PixelSnapHelpers.PixelAlign(r.Top + 1, pixelSize.Height), + PixelSnapHelpers.PixelAlign(r.Right, pixelSize.Width), + PixelSnapHelpers.PixelAlign(r.Bottom + 1, pixelSize.Height)); } else { AddRectangle(r.Left, r.Top + 1, r.Right, r.Bottom + 1); } @@ -89,7 +97,8 @@ namespace ICSharpCode.AvalonEdit.Rendering /// /// Calculates the list of rectangle where the segment in shown. - /// This returns one rectangle for each line inside the segment. + /// This method usually returns one rectangle for each line inside the segment + /// (but potentially more, e.g. when bidirectional text is involved). /// public static IEnumerable GetRectsForSegment(TextView textView, ISegment segment, bool extendToFullWidthAtLineEnd = false) { @@ -232,6 +241,11 @@ namespace ICSharpCode.AvalonEdit.Rendering /// /// Adds a rectangle to the geometry. /// + /// + /// This overload assumes that the coordinates are aligned properly + /// (see , ). + /// Use the -overload instead if the coordinates are not yet aligned. + /// public void AddRectangle(double left, double top, double right, double bottom) { if (!top.IsClose(lastBottom)) {