Skip to content

Commit

Permalink
Remove useless color checks
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Dec 15, 2022
1 parent cc4048c commit c7990a0
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions source/Cosmos.System2/Graphics/Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@ public virtual void DrawFilledCircle(Color color, int x0, int y0, int radius)
(origin.x + x, origin.y + y);
if (color == null)
throw new ArgumentNullException(nameof(color));
ThrowIfCoordNotValid(x_center + radius, y_center);
ThrowIfCoordNotValid(x_center - radius, y_center);
ThrowIfCoordNotValid(x_center, y_center + radius);
Expand Down Expand Up @@ -503,10 +501,6 @@ public virtual void DrawFilledCircle(Color color, Point point, int radius)
/// <exception cref="Exception">Thrown on memory access violation.</exception>
public virtual void DrawEllipse(Color color, int x_center, int y_center, int x_radius, int y_radius)
{
if (color == null)
{
throw new ArgumentNullException(nameof(color));
}
ThrowIfCoordNotValid(x_center + x_radius, y_center);
ThrowIfCoordNotValid(x_center - x_radius, y_center);
ThrowIfCoordNotValid(x_center, y_center + y_radius);
Expand Down Expand Up @@ -637,10 +631,6 @@ public virtual void DrawPolygon(Color color, params Point[] points)
{
throw new ArgumentException("A polygon requires more than 3 points.");
}
if (color == null)
{
throw new ArgumentNullException(nameof(color));
}
for (int i = 0; i < points.Length - 1; i++)
{
DrawLine(color, points[i], points[i + 1]);
Expand Down Expand Up @@ -733,10 +723,7 @@ public virtual void DrawRectangle(Color color, int x, int y, int width, int heig
* we must draw four lines connecting any vertex of our rectangle to do this we first obtain the position of these
* vertex (we call these vertexes A, B, C, D as for geometric convention)
*/
if (color == null)
{
throw new ArgumentNullException(nameof(color));
}

/* The check of the validity of x and y are done in DrawLine() */

/* The vertex A is where x,y are */
Expand Down

0 comments on commit c7990a0

Please sign in to comment.