chore : replaced var with explicit types

This commit is contained in:
gelaws-hub 2025-07-31 20:41:48 +07:00
parent b344b6a03f
commit 64841332e0
4 changed files with 34 additions and 33 deletions

View file

@ -19,11 +19,13 @@ public class ImageService : IImageService
public async Task<byte[]> GenerateImageAsync(GenerateImageRequest request)
{
// 1. Delegate parsing to the CoordinateParser
var (minRow, minCol, maxRow, maxCol) = CoordinateParser.ParseCanvasRect(request.CanvasRect);
(int minRow, int minCol, int maxRow, int maxCol) = CoordinateParser.ParseCanvasRect(
request.CanvasRect
);
// 2. Perform high-level calculations
var stitchedCanvasWidth = (maxCol - minCol + 1) * TILE_SIZE;
var stitchedCanvasHeight = (maxRow - minRow + 1) * TILE_SIZE;
int stitchedCanvasWidth = (maxCol - minCol + 1) * TILE_SIZE;
int stitchedCanvasHeight = (maxRow - minRow + 1) * TILE_SIZE;
int cropX = (int)(request.CropOffset[0] * stitchedCanvasWidth);
int cropY = (int)(request.CropOffset[1] * stitchedCanvasHeight);
@ -35,13 +37,13 @@ public class ImageService : IImageService
throw new ArgumentException("Calculated crop dimensions are invalid.");
}
var startTileCol = minCol + (cropX / TILE_SIZE);
var endTileCol = minCol + ((cropX + cropW - 1) / TILE_SIZE);
var startTileRow = minRow + (cropY / TILE_SIZE);
var endTileRow = minRow + ((cropY + cropH - 1) / TILE_SIZE);
int startTileCol = minCol + (cropX / TILE_SIZE);
int endTileCol = minCol + ((cropX + cropW - 1) / TILE_SIZE);
int startTileRow = minRow + (cropY / TILE_SIZE);
int endTileRow = minRow + ((cropY + cropH - 1) / TILE_SIZE);
// 3. Create a parameter object for the processor
var stitchRequest = new StitchRequest(
StitchRequest stitchRequest = new StitchRequest(
minRow,
minCol,
startTileRow,