From 8abc952c74da426257ef4fff25be1b72ffeb1eb4 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 4 Nov 2021 19:38:40 +0000 Subject: [PATCH] simulate-chunk-selector: do not reallocate colours on every frame --- tools/simulate-chunk-selector.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/simulate-chunk-selector.php b/tools/simulate-chunk-selector.php index 9ae7a1161..b4af186e2 100644 --- a/tools/simulate-chunk-selector.php +++ b/tools/simulate-chunk-selector.php @@ -57,16 +57,16 @@ function render(int $radius, int $baseX, int $baseZ, int $chunksPerStep, int $sc $middleOffsetX = $scale * ($radius + $offsetX); $middleOffsetZ = $scale * ($radius + $offsetZ); + $black = imagecolorallocate($image, 0, 0, 0); + $yellow = imagecolorallocate($image, 255, 255, 51); + $red = imagecolorallocate($image, 255, 0, 0); + if($black === false || $yellow === false || $red === false) throw new AssumptionFailedError(); + $frame = 0; $seen = []; while($iterator->valid()){ $frame++; - $black = imagecolorallocate($image, 0, 0, 0); - $yellow = imagecolorallocate($image, 255, 255, 51); - $red = imagecolorallocate($image, 255, 0, 0); - if($black === false || $yellow === false || $red === false) throw new AssumptionFailedError(); - for($i = 0; $i < $chunksPerStep; ++$i){ $chunkHash = $iterator->current(); if(!isset($seen[$chunkHash])){