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 27 matching lines...) Expand all Loading... |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() { | 40 CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() { |
41 m_iDataLenth = 8; | 41 m_iDataLenth = 8; |
42 m_codeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; | 42 m_codeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; |
43 } | 43 } |
44 CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() {} | 44 CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() {} |
45 void CBC_OnedEAN8Writer::SetDataLength(int32_t length) { | 45 void CBC_OnedEAN8Writer::SetDataLength(int32_t length) { |
46 m_iDataLenth = 8; | 46 m_iDataLenth = 8; |
47 } | 47 } |
48 FX_BOOL CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) { | 48 bool CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) { |
49 if (location == BC_TEXT_LOC_BELOWEMBED) { | 49 if (location == BC_TEXT_LOC_BELOWEMBED) { |
50 m_locTextLoc = location; | 50 m_locTextLoc = location; |
51 return TRUE; | 51 return true; |
52 } | 52 } |
53 return FALSE; | 53 return false; |
54 } | 54 } |
55 FX_BOOL CBC_OnedEAN8Writer::CheckContentValidity( | 55 bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) { |
56 const CFX_WideStringC& contents) { | |
57 for (int32_t i = 0; i < contents.GetLength(); i++) { | 56 for (int32_t i = 0; i < contents.GetLength(); i++) { |
58 if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') { | 57 if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') { |
59 continue; | 58 continue; |
60 } else { | 59 } else { |
61 return FALSE; | 60 return false; |
62 } | 61 } |
63 } | 62 } |
64 return TRUE; | 63 return true; |
65 } | 64 } |
66 CFX_WideString CBC_OnedEAN8Writer::FilterContents( | 65 CFX_WideString CBC_OnedEAN8Writer::FilterContents( |
67 const CFX_WideStringC& contents) { | 66 const CFX_WideStringC& contents) { |
68 CFX_WideString filtercontents; | 67 CFX_WideString filtercontents; |
69 FX_WCHAR ch; | 68 FX_WCHAR ch; |
70 for (int32_t i = 0; i < contents.GetLength(); i++) { | 69 for (int32_t i = 0; i < contents.GetLength(); i++) { |
71 ch = contents.GetAt(i); | 70 ch = contents.GetAt(i); |
72 if (ch > 175) { | 71 if (ch > 175) { |
73 i++; | 72 i++; |
74 continue; | 73 continue; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 254 } |
256 device->DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize, | 255 device->DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize, |
257 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); | 256 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
258 } | 257 } |
259 FX_Free(pCharPos); | 258 FX_Free(pCharPos); |
260 } | 259 } |
261 | 260 |
262 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, | 261 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, |
263 uint8_t* code, | 262 uint8_t* code, |
264 int32_t codeLength, | 263 int32_t codeLength, |
265 FX_BOOL isDevice, | 264 bool isDevice, |
266 int32_t& e) { | 265 int32_t& e) { |
267 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 266 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
268 } | 267 } |
OLD | NEW |