summaryrefslogtreecommitdiff
path: root/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-06 14:23:26 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-06 23:30:04 +0000
commit8a24b25ee0b08128b28dfae0ee86b8348a51b40b (patch)
treea1dcaba3bddca1316bb9ba8fb9e2c0e0b1242301 /fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
parentc758d9dd3f94c2dee89e7fdd50195af08f7e456c (diff)
downloadpdfium-8a24b25ee0b08128b28dfae0ee86b8348a51b40b.tar.xz
Clean up CBC_QRCoderVersion and friends.
Change-Id: Iff738c99fb4fe38d35515c280057b489624d734f Reviewed-on: https://pdfium-review.googlesource.com/3752 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/qrcode/BC_QRCoderECBlocks.cpp')
-rw-r--r--fxbarcode/qrcode/BC_QRCoderECBlocks.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
index e07197df93..28f46882d9 100644
--- a/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
@@ -20,44 +20,28 @@
* limitations under the License.
*/
-#include "fxbarcode/qrcode/BC_QRCoderECB.h"
#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks)
- : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.push_back(ecBlocks);
-}
+#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
- CBC_QRCoderECB* ecBlocks1,
- CBC_QRCoderECB* ecBlocks2)
- : m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.push_back(ecBlocks1);
- m_ecBlocksArray.push_back(ecBlocks2);
-}
+CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(const CBC_QRCoderECBlockData& data)
+ : m_data(data) {}
-CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {
- for (size_t i = 0; i < m_ecBlocksArray.size(); i++)
- delete m_ecBlocksArray[i];
-}
+CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {}
int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
- return m_ecCodeWordsPerBlock;
+ return m_data.ecCodeWordsPerBlock;
}
int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
- int32_t total = 0;
- for (size_t i = 0; i < m_ecBlocksArray.size(); i++)
- total += m_ecBlocksArray[i]->GetCount();
-
- return total;
+ return m_data.count1 + m_data.count2;
}
int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
- return m_ecCodeWordsPerBlock * GetNumBlocks();
+ return GetECCodeWordsPerBlock() * GetNumBlocks();
}
-std::vector<CBC_QRCoderECB*>* CBC_QRCoderECBlocks::GetECBlocks() {
- return &m_ecBlocksArray;
+int32_t CBC_QRCoderECBlocks::GetTotalDataCodeWords() const {
+ return m_data.count1 * (m_data.dataCodeWords1 + GetECCodeWordsPerBlock()) +
+ m_data.count2 * (m_data.dataCodeWords2 + GetECCodeWordsPerBlock());
}