This commit is contained in:
smiley
2023-03-11 19:12:29 +01:00
parent 7b10197135
commit 63056190f7
2 changed files with 6 additions and 11 deletions
+2 -3
View File
@@ -578,9 +578,8 @@ class QRMatrix{
$startY = ((($startY !== null) ? $startY : ($length - $height) / 2) + $qz);
// clear the space
foreach($this->matrix as $y => $row){
/** @SuppressWarnings(PHPMD.UnusedLocalVariable) */
foreach($row as $x => $val){
for($y = 0; $y < $this->moduleCount; $y++){
for($x = 0; $x < $this->moduleCount; $x++){
// out of bounds, skip
if($x < $start || $y < $start ||$x >= $end || $y >= $end){
continue;
+4 -8
View File
@@ -204,16 +204,12 @@ final class Binarizer{
* @see http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
*/
private function calculateBlackPoints(int $subWidth, int $subHeight, int $width, int $height):array{
$blackPoints = array_fill(0, $subHeight, 0);
/** @SuppressWarnings(PHPMD.UnusedLocalVariable) */
foreach($blackPoints as $key => $point){
$blackPoints[$key] = array_fill(0, $subWidth, 0);
}
$blackPoints = [];
for($y = 0; $y < $subHeight; $y++){
$yoffset = ($y << self::BLOCK_SIZE_POWER);
$maxYOffset = ($height - self::BLOCK_SIZE);
$yoffset = ($y << self::BLOCK_SIZE_POWER);
$maxYOffset = ($height - self::BLOCK_SIZE);
$blackPoints[$y] = [];
if($yoffset > $maxYOffset){
$yoffset = $maxYOffset;