From f852e1433143fc85ec6ecf08dee29f40b8e259ec Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Mon, 20 Mar 2023 16:39:19 -0500 Subject: [PATCH] move some functions around --- .../base_extentions/bitmatrix.rs | 31 ++++++------------- src/qrcode/decoder/version.rs | 6 ++-- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/common/cpp_essentials/base_extentions/bitmatrix.rs b/src/common/cpp_essentials/base_extentions/bitmatrix.rs index d0d3fc6..95ebd37 100644 --- a/src/common/cpp_essentials/base_extentions/bitmatrix.rs +++ b/src/common/cpp_essentials/base_extentions/bitmatrix.rs @@ -18,7 +18,7 @@ impl BitMatrix { let yOffset = top + y as f32 * subSampling; for x in 0..result.width() { // for (int x = 0; x < result.width(); x++) { - if (self.get_point(point(left + x as f32 * subSampling, yOffset))) { + if self.get_point(point(left + x as f32 * subSampling, yOffset)) { result.set(x, y); } } @@ -27,6 +27,14 @@ impl BitMatrix { Ok(result) } + pub fn getTopLeftOnBitWithPosition(&self, left: u32, top: u32) -> (bool, u32, u32) { + todo!() + } + + pub fn getBottomRightOnBitWithPosition(&self, right: u32, bottom: u32) -> (bool, u32, u32) { + todo!() + } + pub fn findBoundingBox( &self, left: u32, @@ -36,26 +44,5 @@ impl BitMatrix { minSize: u32, ) -> (bool, u32, u32, u32, u32) { todo!() - // let right; - // let bottom; - // if (!self.getTopLeftOnBitWithPosition(left, top) || !self.getBottomRightOnBitWithPosition(right, bottom) || bottom - top + 1 < minSize) - // {return false;} - - // for (int y = top; y <= bottom; y++ ) { - // for (int x = 0; x < left; ++x) - // if (get(x, y)) { - // left = x; - // break; - // } - // for (int x = _width-1; x > right; x--) - // if (get(x, y)) { - // right = x; - // break; - // } - // } - - // width = right - left + 1; - // height = bottom - top + 1; - // return width >= minSize && height >= minSize; } } diff --git a/src/qrcode/decoder/version.rs b/src/qrcode/decoder/version.rs index 461d0c6..a325780 100755 --- a/src/qrcode/decoder/version.rs +++ b/src/qrcode/decoder/version.rs @@ -930,7 +930,7 @@ impl ECBlocks { } } - pub fn getECCodewordsPerBlock(&self) -> u32 { + pub const fn getECCodewordsPerBlock(&self) -> u32 { self.ecCodewordsPerBlock } @@ -970,11 +970,11 @@ impl ECB { } } - pub fn getCount(&self) -> u32 { + pub const fn getCount(&self) -> u32 { self.count } - pub fn getDataCodewords(&self) -> u32 { + pub const fn getDataCodewords(&self) -> u32 { self.dataCodewords } }