Inline temporary variable.

This commit is contained in:
2022-11-15 00:20:20 +00:00
parent 2f6ef0c498
commit 47965f0584
7 changed files with 28 additions and 40 deletions

View File

@@ -444,21 +444,20 @@ public sealed class BlockMap : ItemsControl
using IDrawingContextImpl ctxi = _bitmap.CreateDrawingContext(null);
using var ctx = new DrawingContext(ctxi, false);
int squareWidth = (sideLength - 2 * borderWidth) / colors.Length;
int squareHeight = squareWidth;
var x = 0;
var y = 0;
int squareWidth = (sideLength - 2 * borderWidth) / colors.Length;
var x = 0;
var y = 0;
foreach(Color color in colors)
{
ctx.FillRectangle(new SolidColorBrush(color), new Rect(x, y, squareWidth, squareHeight));
ctx.FillRectangle(new SolidColorBrush(color), new Rect(x, y, squareWidth, squareWidth));
x += squareWidth + 2 * borderWidth;
if(x < sideLength)
continue;
x = 0;
y += squareHeight + 2 * borderWidth;
y += squareWidth + 2 * borderWidth;
}
}