smiley 2 yıl önce
ebeveyn
işleme
2f0b169039
1 değiştirilmiş dosya ile 3 ekleme ve 4 silme
  1. 3 4
      src/Decoder/Binarizer.php

+ 3 - 4
src/Decoder/Binarizer.php

@@ -204,12 +204,11 @@ final class Binarizer{
 	 * @see http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
 	 * @see http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
 	 */
 	 */
 	private function calculateBlackPoints(int $subWidth, int $subHeight, int $width, int $height):array{
 	private function calculateBlackPoints(int $subWidth, int $subHeight, int $width, int $height):array{
-		$blackPoints = [];
+		$blackPoints = array_fill(0, $subHeight, array_fill(0, $subWidth, 0));
 
 
 		for($y = 0; $y < $subHeight; $y++){
 		for($y = 0; $y < $subHeight; $y++){
-			$yoffset         = ($y << self::BLOCK_SIZE_POWER);
-			$maxYOffset      = ($height - self::BLOCK_SIZE);
-			$blackPoints[$y] = [];
+			$yoffset    = ($y << self::BLOCK_SIZE_POWER);
+			$maxYOffset = ($height - self::BLOCK_SIZE);
 
 
 			if($yoffset > $maxYOffset){
 			if($yoffset > $maxYOffset){
 				$yoffset = $maxYOffset;
 				$yoffset = $maxYOffset;