| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
| 7 /* | 7 /* |
| 8 * Copyright 2011 ZXing authors | 8 * Copyright 2011 ZXing authors |
| 9 * | 9 * |
| 10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() { | 53 CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() { |
| 54 return m_matrix[m_currentRow]; | 54 return m_matrix[m_currentRow]; |
| 55 } | 55 } |
| 56 int32_t CBC_BarcodeMatrix::getWidth() { | 56 int32_t CBC_BarcodeMatrix::getWidth() { |
| 57 return m_outWidth; | 57 return m_outWidth; |
| 58 } | 58 } |
| 59 int32_t CBC_BarcodeMatrix::getHeight() { | 59 int32_t CBC_BarcodeMatrix::getHeight() { |
| 60 return m_outHeight; | 60 return m_outHeight; |
| 61 } | 61 } |
| 62 CFX_ByteArray& CBC_BarcodeMatrix::getMatrix() { | 62 CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getMatrix() { |
| 63 return getScaledMatrix(1, 1); | 63 return getScaledMatrix(1, 1); |
| 64 } | 64 } |
| 65 CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) { | 65 CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) { |
| 66 return getScaledMatrix(scale, scale); | 66 return getScaledMatrix(scale, scale); |
| 67 } | 67 } |
| 68 CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, | 68 CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, |
| 69 int32_t yScale) { | 69 int32_t yScale) { |
| 70 int32_t yMax = m_height * yScale; | 70 int32_t yMax = m_height * yScale; |
| 71 CFX_ByteArray bytearray; | 71 CFX_ArrayTemplate<uint8_t> bytearray; |
| 72 bytearray.Copy(m_matrix[0]->getScaledRow(xScale)); | 72 bytearray.Copy(m_matrix[0]->getScaledRow(xScale)); |
| 73 int32_t xMax = bytearray.GetSize(); | 73 int32_t xMax = bytearray.GetSize(); |
| 74 m_matrixOut.SetSize(xMax * yMax); | 74 m_matrixOut.SetSize(xMax * yMax); |
| 75 m_outWidth = xMax; | 75 m_outWidth = xMax; |
| 76 m_outHeight = yMax; | 76 m_outHeight = yMax; |
| 77 int32_t k = 0; | 77 int32_t k = 0; |
| 78 for (int32_t i = 0; i < yMax; i++) { | 78 for (int32_t i = 0; i < yMax; i++) { |
| 79 if (i != 0) { | 79 if (i != 0) { |
| 80 bytearray.Copy(m_matrix[i / yScale]->getScaledRow(xScale)); | 80 bytearray.Copy(m_matrix[i / yScale]->getScaledRow(xScale)); |
| 81 } | 81 } |
| 82 k = i * xMax; | 82 k = i * xMax; |
| 83 for (int32_t l = 0; l < xMax; l++) { | 83 for (int32_t l = 0; l < xMax; l++) { |
| 84 m_matrixOut[k + l] = bytearray.GetAt(l); | 84 m_matrixOut[k + l] = bytearray.GetAt(l); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 return m_matrixOut; | 87 return m_matrixOut; |
| 88 } | 88 } |
| OLD | NEW |