Skip to content

Commit

Permalink
Merge pull request #713 from WildernessLabs/bug/micrographics-valign
Browse files Browse the repository at this point in the history
bug fix in valign
  • Loading branch information
adrianstevens authored Jul 28, 2023
2 parents 47eae1a + 4c70eba commit ca168c7
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public IFont CurrentFont
DisplayConfig.Height = (ushort)(Height / CurrentFont.Height);
}
}
IFont? currentFont = null;

private IFont? currentFont = null;

/// <summary>
/// Current color mode
Expand All @@ -70,7 +71,7 @@ public RotationType Rotation
}
}

RotationType _rotation = RotationType.Default;
private RotationType _rotation = RotationType.Default;

/// <summary>
/// Stroke / line thickness when drawing lines or shape outlines
Expand Down Expand Up @@ -122,15 +123,14 @@ public int Width
/// </summary>
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;

/// <summary>
/// Time of last display update when callng ShowBuffered
/// </summary>
DateTime lastUpdated;
private DateTime lastUpdated;

/// <summary>
/// Create a new MicroGraphics instance from a display perihperal driver instance
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1778,15 +1778,15 @@ 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;

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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit ca168c7

Please sign in to comment.