Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1661)

Side by Side Diff: xfa/fxbarcode/cbc_upca.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/cbc_upca.h ('k') | xfa/fxbarcode/common/BC_CommonBitArray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 /* 6 /*
7 * Copyright 2011 ZXing authors 7 * Copyright 2011 ZXing authors
8 * 8 *
9 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License. 10 * you may not use this file except in compliance with the License.
(...skipping 29 matching lines...) Expand all
40 int32_t checksum = pWriter->CalcChecksum(byteString); 40 int32_t checksum = pWriter->CalcChecksum(byteString);
41 byteString += checksum - 0 + '0'; 41 byteString += checksum - 0 + '0';
42 encodeContents = byteString.UTF8Decode(); 42 encodeContents = byteString.UTF8Decode();
43 } 43 }
44 if (length > 12) 44 if (length > 12)
45 encodeContents = encodeContents.Mid(0, 12); 45 encodeContents = encodeContents.Mid(0, 12);
46 46
47 return encodeContents; 47 return encodeContents;
48 } 48 }
49 49
50 FX_BOOL CBC_UPCA::Encode(const CFX_WideStringC& contents, 50 bool CBC_UPCA::Encode(const CFX_WideStringC& contents,
51 FX_BOOL isDevice, 51 bool isDevice,
52 int32_t& e) { 52 int32_t& e) {
53 if (contents.IsEmpty()) { 53 if (contents.IsEmpty()) {
54 e = BCExceptionNoContents; 54 e = BCExceptionNoContents;
55 return FALSE; 55 return false;
56 } 56 }
57 BCFORMAT format = BCFORMAT_UPC_A; 57 BCFORMAT format = BCFORMAT_UPC_A;
58 int32_t outWidth = 0; 58 int32_t outWidth = 0;
59 int32_t outHeight = 0; 59 int32_t outHeight = 0;
60 CFX_WideString encodeContents = Preprocess(contents); 60 CFX_WideString encodeContents = Preprocess(contents);
61 CFX_ByteString byteString = encodeContents.UTF8Encode(); 61 CFX_ByteString byteString = encodeContents.UTF8Encode();
62 m_renderContents = encodeContents; 62 m_renderContents = encodeContents;
63 63
64 CBC_OnedUPCAWriter* pWriter = 64 CBC_OnedUPCAWriter* pWriter =
65 static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get()); 65 static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter.get());
66 66
67 pWriter->Init(); 67 pWriter->Init();
68 uint8_t* data = pWriter->Encode(byteString, format, outWidth, outHeight, e); 68 uint8_t* data = pWriter->Encode(byteString, format, outWidth, outHeight, e);
69 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 69 BC_EXCEPTION_CHECK_ReturnValue(e, false);
70 pWriter->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice, 70 pWriter->RenderResult(encodeContents.AsStringC(), data, outWidth, isDevice,
71 e); 71 e);
72 FX_Free(data); 72 FX_Free(data);
73 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 73 BC_EXCEPTION_CHECK_ReturnValue(e, false);
74 return TRUE; 74 return true;
75 } 75 }
76 76
77 FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, 77 bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
78 const CFX_Matrix* matrix, 78 const CFX_Matrix* matrix,
79 int32_t& e) { 79 int32_t& e) {
80 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 80 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
81 ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e); 81 ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
82 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 82 BC_EXCEPTION_CHECK_ReturnValue(e, false);
83 return TRUE; 83 return true;
84 } 84 }
85 85
86 FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { 86 bool CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
87 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 87 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
88 ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e); 88 ->RenderBitmapResult(pOutBitmap, m_renderContents.AsStringC(), e);
89 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 89 BC_EXCEPTION_CHECK_ReturnValue(e, false);
90 return TRUE; 90 return true;
91 } 91 }
92 92
93 BC_TYPE CBC_UPCA::GetType() { 93 BC_TYPE CBC_UPCA::GetType() {
94 return BC_UPCA; 94 return BC_UPCA;
95 } 95 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/cbc_upca.h ('k') | xfa/fxbarcode/common/BC_CommonBitArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698