diff --git a/source/Cosmos.System2/Graphics/Canvas.cs b/source/Cosmos.System2/Graphics/Canvas.cs index b464eda8da..208b07ca13 100644 --- a/source/Cosmos.System2/Graphics/Canvas.cs +++ b/source/Cosmos.System2/Graphics/Canvas.cs @@ -569,19 +569,24 @@ public virtual void DrawRectangle(Color color, int x, int y, int width, int heig /// The height of the rectangle. public virtual void DrawFilledRectangle(Color color, int xStart, int yStart, int width, int height, bool preventOffBoundPixels = true) { - if (height == -1) - { - height = width; - } - if (preventOffBoundPixels) - { - width = Math.Min(width, (int)Mode.Width - xStart); - height = Math.Min(height, (int)Mode.Height - yStart); - } - for (int y = yStart; y < yStart + height; y++) - { - DrawLine(color, xStart, y, xStart + width - 1, y); - } + if (height == -1) + { + height = width; + } + + if (preventOffBoundPixels) + { + width = Math.Min(width, (int)Mode.Width - xStart); + height = Math.Min(height, (int)Mode.Height - yStart); + } + + for (int j = yStart; j < yStart + height; j++) + { + for (int i = xStart; i < xStart + width; i++) + { + DrawPoint(color, i, j); + } + } } /// @@ -988,4 +993,4 @@ public static Color AlphaBlend(Color to, Color from, byte alpha) return Color.FromArgb(R, G, B); } } -} \ No newline at end of file +}