Skip to content

Commit dbdd4b9

Browse files
committed
Update board size calculations
1 parent 0341de3 commit dbdd4b9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/DiagramGenerator/Image/Image.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,18 @@ protected function getBaseBoard(BaseImage $backgroundTexture = null, $cellSize,
203203
if ($backgroundTexture) {
204204
$this->addTransparencyIfNeeded($board, $backgroundTexture->getCore());
205205

206+
$destWidth = $cellSize * Board::SQUARES_IN_ROW;
207+
$destHeight = $cellSize * Board::SQUARES_IN_ROW + $topPaddingOfCell;
208+
$srcWidth = $backgroundTexture->getWidth();
209+
$srcHeight = $backgroundTexture->getHeight();
210+
206211
imagecopyresampled(
207212
$board, $backgroundTexture->getCore(),
208213
0, 0, 0, 0,
209-
$cellSize * Board::SQUARES_IN_ROW,
210-
$cellSize * Board::SQUARES_IN_ROW + $topPaddingOfCell,
211-
$cellSize * Board::SQUARES_IN_ROW,
212-
$cellSize * Board::SQUARES_IN_ROW + $topPaddingOfCell
214+
$destWidth,
215+
$destHeight,
216+
$srcWidth,
217+
$srcHeight
213218
);
214219
}
215220

0 commit comments

Comments
 (0)