From 8b6186f89002099d406508acecf4bccc4ef64c95 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 28 Mar 2017 12:06:45 -0700 Subject: Remove CFX_ArrayTemplate from FX barcode code. This is now the last usage in pdfium, types to be removed in a follow-on CL. Change-Id: I16f67eb3eb99f21bb231829168203be125129ad7 Reviewed-on: https://pdfium-review.googlesource.com/3247 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp') diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp index 243af70d94..427da9d588 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp @@ -22,32 +22,31 @@ #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h" -CBC_BarcodeRow::CBC_BarcodeRow(int32_t width) { - m_row.SetSize(width); - m_currentLocation = 0; -} -CBC_BarcodeRow::~CBC_BarcodeRow() { - m_output.RemoveAll(); - m_row.RemoveAll(); -} +CBC_BarcodeRow::CBC_BarcodeRow(size_t width) + : m_row(width), m_currentLocation(0) {} + +CBC_BarcodeRow::~CBC_BarcodeRow() {} + void CBC_BarcodeRow::set(int32_t x, uint8_t value) { - m_row.SetAt(x, value); + m_row[x] = value; } + void CBC_BarcodeRow::set(int32_t x, bool black) { - m_row.SetAt(x, (uint8_t)(black ? 1 : 0)); + m_row[x] = black ? 1 : 0; } + void CBC_BarcodeRow::addBar(bool black, int32_t width) { - for (int32_t ii = 0; ii < width; ii++) { + for (int32_t ii = 0; ii < width; ii++) set(m_currentLocation++, black); - } } -CFX_ArrayTemplate& CBC_BarcodeRow::getRow() { + +std::vector& CBC_BarcodeRow::getRow() { return m_row; } -CFX_ArrayTemplate& CBC_BarcodeRow::getScaledRow(int32_t scale) { - m_output.SetSize(m_row.GetSize() * scale); - for (int32_t i = 0; i < m_output.GetSize(); i++) { - m_output[i] = (m_row[i / scale]); - } + +std::vector& CBC_BarcodeRow::getScaledRow(int32_t scale) { + m_output.resize(m_row.size() * scale); + for (size_t i = 0; i < m_output.size(); i++) + m_output[i] = m_row[i / scale]; return m_output; } -- cgit v1.2.3