From 196dd6e4c11d606529fcf3a6903d1b1cbc77080a Mon Sep 17 00:00:00 2001 From: huysentruitw Date: Wed, 9 Feb 2022 09:14:50 +0100 Subject: [PATCH] Swap vertical/horizontal variables in row/column calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently has no impact as all code-sizes are square, but if support for rectangular DataMatrix would be added, then this would have been an issue. (I might try to add that support, but I don't know Go 🙂) --- datamatrix/codesize.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datamatrix/codesize.go b/datamatrix/codesize.go index c63eb8c..853eb8a 100644 --- a/datamatrix/codesize.go +++ b/datamatrix/codesize.go @@ -10,19 +10,19 @@ type dmCodeSize struct { } func (s *dmCodeSize) RegionRows() int { - return (s.Rows - (s.RegionCountHorizontal * 2)) / s.RegionCountHorizontal + return (s.Rows - (s.RegionCountVertical * 2)) / s.RegionCountVertical } func (s *dmCodeSize) RegionColumns() int { - return (s.Columns - (s.RegionCountVertical * 2)) / s.RegionCountVertical + return (s.Columns - (s.RegionCountHorizontal * 2)) / s.RegionCountHorizontal } func (s *dmCodeSize) MatrixRows() int { - return s.RegionRows() * s.RegionCountHorizontal + return s.RegionRows() * s.RegionCountVertical } func (s *dmCodeSize) MatrixColumns() int { - return s.RegionColumns() * s.RegionCountVertical + return s.RegionColumns() * s.RegionCountHorizontal } func (s *dmCodeSize) DataCodewords() int {