From 4c70ebaf427132cf78050f4431c6feb56cbb707e Mon Sep 17 00:00:00 2001 From: Chris Tacke Date: Fri, 28 Jul 2023 17:38:56 -0500 Subject: [PATCH] bug fix in valign --- .../Driver/MicroGraphics.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.cs b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.cs index 0eeff34e52..c45e56cedd 100644 --- a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.cs +++ b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.cs @@ -46,7 +46,8 @@ public IFont CurrentFont DisplayConfig.Height = (ushort)(Height / CurrentFont.Height); } } - IFont? currentFont = null; + + private IFont? currentFont = null; /// /// Current color mode @@ -70,7 +71,7 @@ public RotationType Rotation } } - RotationType _rotation = RotationType.Default; + private RotationType _rotation = RotationType.Default; /// /// Stroke / line thickness when drawing lines or shape outlines @@ -122,15 +123,14 @@ public int Width /// public TimeSpan DelayBetweenFrames { get; set; } = TimeSpan.Zero; - readonly object _lock = new object(); - - bool isUpdating = false; - bool isUpdateRequested = false; + private readonly object _lock = new object(); + private bool isUpdating = false; + private bool isUpdateRequested = false; /// /// Time of last display update when callng ShowBuffered /// - DateTime lastUpdated; + private DateTime lastUpdated; /// /// Create a new MicroGraphics instance from a display perihperal driver instance @@ -366,7 +366,7 @@ public void DrawLine(int x0, int y0, int x1, int y1, Color color) } // Helper method, can be integrated with DrawLine after we add DrawQuad - void DrawSingleWidthLine(int x0, int y0, int x1, int y1, Color color) + private void DrawSingleWidthLine(int x0, int y0, int x1, int y1, Color color) { var steep = Math.Abs(y1 - y0) > Math.Abs(x1 - x0); if (steep) @@ -687,7 +687,7 @@ public void DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, bool fi DrawTriangle(x0, y0, x1, y1, x2, y2, PenColor, filled); } - void Swap(ref int value1, ref int value2) + private void Swap(ref int value1, ref int value2) { (value2, value1) = (value1, value2); } @@ -1255,8 +1255,8 @@ public void DrawText(int x, int y, string text, Color color, byte[] bitMap = GetBytesForTextBitmap(text, fontToDraw); - x = GetXForAlignment(x, MeasureText(text, scaleFactor).Width, alignmentH); - y = GetYForAlignment(y, MeasureText(text, scaleFactor).Height, alignmentV); + x = GetXForAlignment(x, MeasureText(text, fontToDraw, scaleFactor).Width, alignmentH); + y = GetYForAlignment(y, MeasureText(text, fontToDraw, scaleFactor).Height, alignmentV); DrawBitmap(x, y, bitMap.Length / fontToDraw.Height * 8, fontToDraw.Height, bitMap, color, scaleFactor); } @@ -1778,7 +1778,7 @@ public int GetYForRotation(int x, int y) }; } - bool IsCoordinateInBounds(int x, int y) + private bool IsCoordinateInBounds(int x, int y) { if (x < 0 || y < 0 || x >= Width || y >= Height) return false; @@ -1786,7 +1786,7 @@ bool IsCoordinateInBounds(int x, int y) return true; } - void Fill(int x, int y, int width, int height, Color color) + private void Fill(int x, int y, int width, int height, Color color) { if (IgnoreOutOfBoundsPixels) { @@ -1828,7 +1828,7 @@ void Fill(int x, int y, int width, int height, Color color) } } - int GetXForAlignment(int x, int width, HorizontalAlignment alignmentH) + private int GetXForAlignment(int x, int width, HorizontalAlignment alignmentH) { if (alignmentH == HorizontalAlignment.Center) { @@ -1841,7 +1841,7 @@ int GetXForAlignment(int x, int width, HorizontalAlignment alignmentH) return x; } - int GetYForAlignment(int y, int height, VerticalAlignment alignmentV) + private int GetYForAlignment(int y, int height, VerticalAlignment alignmentV) { if (alignmentV == VerticalAlignment.Center) {