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 2009 ZXing authors | 8 * Copyright 2009 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 {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}}; | 37 {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}}; |
38 const int32_t L_AND_G_PATTERNS[20][4] = { | 38 const int32_t L_AND_G_PATTERNS[20][4] = { |
39 {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2}, | 39 {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2}, |
40 {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}, | 40 {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}, |
41 {1, 1, 2, 3}, {1, 2, 2, 2}, {2, 2, 1, 2}, {1, 1, 4, 1}, {2, 3, 1, 1}, | 41 {1, 1, 2, 3}, {1, 2, 2, 2}, {2, 2, 1, 2}, {1, 1, 4, 1}, {2, 3, 1, 1}, |
42 {1, 3, 2, 1}, {4, 1, 1, 1}, {2, 1, 3, 1}, {3, 1, 2, 1}, {2, 1, 1, 3}}; | 42 {1, 3, 2, 1}, {4, 1, 1, 1}, {2, 1, 3, 1}, {3, 1, 2, 1}, {2, 1, 1, 3}}; |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() { | 46 CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() { |
47 m_bLeftPadding = TRUE; | 47 m_bLeftPadding = true; |
48 m_codeWidth = 3 + (7 * 6) + 5 + (7 * 6) + 3; | 48 m_codeWidth = 3 + (7 * 6) + 5 + (7 * 6) + 3; |
49 } | 49 } |
50 CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {} | 50 CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {} |
51 FX_BOOL CBC_OnedEAN13Writer::CheckContentValidity( | 51 bool CBC_OnedEAN13Writer::CheckContentValidity( |
52 const CFX_WideStringC& contents) { | 52 const CFX_WideStringC& contents) { |
53 for (int32_t i = 0; i < contents.GetLength(); i++) { | 53 for (int32_t i = 0; i < contents.GetLength(); i++) { |
54 if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') { | 54 if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') { |
55 continue; | 55 continue; |
56 } else { | 56 } else { |
57 return FALSE; | 57 return false; |
58 } | 58 } |
59 } | 59 } |
60 return TRUE; | 60 return true; |
61 } | 61 } |
62 CFX_WideString CBC_OnedEAN13Writer::FilterContents( | 62 CFX_WideString CBC_OnedEAN13Writer::FilterContents( |
63 const CFX_WideStringC& contents) { | 63 const CFX_WideStringC& contents) { |
64 CFX_WideString filtercontents; | 64 CFX_WideString filtercontents; |
65 FX_WCHAR ch; | 65 FX_WCHAR ch; |
66 for (int32_t i = 0; i < contents.GetLength(); i++) { | 66 for (int32_t i = 0; i < contents.GetLength(); i++) { |
67 ch = contents.GetAt(i); | 67 ch = contents.GetAt(i); |
68 if (ch > 175) { | 68 if (ch > 175) { |
69 i++; | 69 i++; |
70 continue; | 70 continue; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, | 290 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, |
291 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); | 291 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
292 } | 292 } |
293 FX_Free(pCharPos); | 293 FX_Free(pCharPos); |
294 } | 294 } |
295 | 295 |
296 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents, | 296 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents, |
297 uint8_t* code, | 297 uint8_t* code, |
298 int32_t codeLength, | 298 int32_t codeLength, |
299 FX_BOOL isDevice, | 299 bool isDevice, |
300 int32_t& e) { | 300 int32_t& e) { |
301 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 301 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
302 } | 302 } |
OLD | NEW |