:octocat: use ZXing classes for RS encoding, cleanup

This commit is contained in:
codemasher
2021-01-16 19:45:30 +01:00
parent 32b6a5ed77
commit 4ce932aee3
5 changed files with 120 additions and 348 deletions
+2 -3
View File
@@ -12,7 +12,7 @@
namespace chillerlan\QRCode\Data;
use chillerlan\QRCode\Common\{EccLevel, Mode, ReedSolomon, Version};
use chillerlan\QRCode\Common\{EccLevel, Mode, ReedSolomonEncoder, Version};
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\Helpers\BitBuffer;
use chillerlan\Settings\SettingsContainerInterface;
@@ -99,8 +99,7 @@ class QRData{
* returns a fresh matrix object with the data written for the given $maskPattern
*/
public function initMatrix(int $maskPattern, bool $test = null):QRMatrix{
$rs = new ReedSolomon($this->version, $this->eccLevel);
$data = $rs->interleaveEcBytes($this->bitBuffer);
$data = (new ReedSolomonEncoder)->interleaveEcBytes($this->bitBuffer, $this->version, $this->eccLevel);
return (new QRMatrix($this->version, $this->eccLevel))
->init($maskPattern, $test)