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 2012 ZXing authors | 8 * Copyright 2012 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 26 matching lines...) Expand all Loading... |
37 FX_BOOL CBC_PDF417Writer::SetErrorCorrectionLevel(int32_t level) { | 37 FX_BOOL CBC_PDF417Writer::SetErrorCorrectionLevel(int32_t level) { |
38 if (level < 0 || level > 8) { | 38 if (level < 0 || level > 8) { |
39 return FALSE; | 39 return FALSE; |
40 } | 40 } |
41 m_iCorrectLevel = level; | 41 m_iCorrectLevel = level; |
42 return TRUE; | 42 return TRUE; |
43 } | 43 } |
44 void CBC_PDF417Writer::SetTruncated(FX_BOOL truncated) { | 44 void CBC_PDF417Writer::SetTruncated(FX_BOOL truncated) { |
45 m_bTruncated = truncated; | 45 m_bTruncated = truncated; |
46 } | 46 } |
47 uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString& contents, | |
48 BCFORMAT format, | |
49 int32_t& outWidth, | |
50 int32_t& outHeight, | |
51 int32_t& e) { | |
52 if (format != BCFORMAT_PDF_417) { | |
53 return NULL; | |
54 } | |
55 CFX_WideString encodeContents = contents.UTF8Decode(); | |
56 return Encode(encodeContents, outWidth, outHeight, e); | |
57 } | |
58 uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString& contents, | |
59 BCFORMAT format, | |
60 int32_t& outWidth, | |
61 int32_t& outHeight, | |
62 int32_t hints, | |
63 int32_t& e) { | |
64 return NULL; | |
65 } | |
66 uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, | 47 uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, |
67 int32_t& outWidth, | 48 int32_t& outWidth, |
68 int32_t& outHeight, | 49 int32_t& outHeight, |
69 int32_t& e) { | 50 int32_t& e) { |
70 CBC_PDF417 encoder; | 51 CBC_PDF417 encoder; |
71 int32_t col = (m_Width / m_ModuleWidth - 69) / 17; | 52 int32_t col = (m_Width / m_ModuleWidth - 69) / 17; |
72 int32_t row = m_Height / (m_ModuleWidth * 20); | 53 int32_t row = m_Height / (m_ModuleWidth * 20); |
73 if (row >= 3 && row <= 90 && col >= 1 && col <= 30) { | 54 if (row >= 3 && row <= 90 && col >= 1 && col <= 30) { |
74 encoder.setDimensions(col, col, row, row); | 55 encoder.setDimensions(col, col, row, row); |
75 } else if (col >= 1 && col <= 30) { | 56 } else if (col >= 1 && col <= 30) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 int32_t width) { | 106 int32_t width) { |
126 CFX_ByteArray temp; | 107 CFX_ByteArray temp; |
127 temp.Copy(bitarray); | 108 temp.Copy(bitarray); |
128 for (int32_t ii = 0; ii < height; ii++) { | 109 for (int32_t ii = 0; ii < height; ii++) { |
129 int32_t inverseii = height - ii - 1; | 110 int32_t inverseii = height - ii - 1; |
130 for (int32_t jj = 0; jj < width; jj++) { | 111 for (int32_t jj = 0; jj < width; jj++) { |
131 bitarray[jj * height + inverseii] = temp[ii * width + jj]; | 112 bitarray[jj * height + inverseii] = temp[ii * width + jj]; |
132 } | 113 } |
133 } | 114 } |
134 } | 115 } |
OLD | NEW |