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

Side by Side Diff: xfa/fxbarcode/cbc_codabar.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_codabar.h ('k') | xfa/fxbarcode/cbc_code128.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.
11 * You may obtain a copy of the License at 11 * You may obtain a copy of the License at
12 * 12 *
13 * http://www.apache.org/licenses/LICENSE-2.0 13 * http://www.apache.org/licenses/LICENSE-2.0
14 * 14 *
15 * Unless required by applicable law or agreed to in writing, software 15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, 16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and 18 * See the License for the specific language governing permissions and
19 * limitations under the License. 19 * limitations under the License.
20 */ 20 */
21 21
22 #include "xfa/fxbarcode/cbc_codabar.h" 22 #include "xfa/fxbarcode/cbc_codabar.h"
23 23
24 #include "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h" 24 #include "xfa/fxbarcode/oned/BC_OnedCodaBarWriter.h"
25 25
26 CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {} 26 CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {}
27 27
28 CBC_Codabar::~CBC_Codabar() {} 28 CBC_Codabar::~CBC_Codabar() {}
29 29
30 FX_BOOL CBC_Codabar::SetStartChar(FX_CHAR start) { 30 bool CBC_Codabar::SetStartChar(FX_CHAR start) {
31 if (!m_pBCWriter) 31 if (!m_pBCWriter)
32 return FALSE; 32 return false;
33 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 33 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
34 ->SetStartChar(start); 34 ->SetStartChar(start);
35 } 35 }
36 36
37 FX_BOOL CBC_Codabar::SetEndChar(FX_CHAR end) { 37 bool CBC_Codabar::SetEndChar(FX_CHAR end) {
38 if (m_pBCWriter) 38 if (m_pBCWriter)
39 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 39 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
40 ->SetEndChar(end); 40 ->SetEndChar(end);
41 return FALSE; 41 return false;
42 } 42 }
43 43
44 FX_BOOL CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) { 44 bool CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) {
45 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 45 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
46 ->SetTextLocation(location); 46 ->SetTextLocation(location);
47 } 47 }
48 48
49 FX_BOOL CBC_Codabar::SetWideNarrowRatio(int32_t ratio) { 49 bool CBC_Codabar::SetWideNarrowRatio(int32_t ratio) {
50 if (m_pBCWriter) 50 if (m_pBCWriter)
51 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 51 return static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
52 ->SetWideNarrowRatio(ratio); 52 ->SetWideNarrowRatio(ratio);
53 return FALSE; 53 return false;
54 } 54 }
55 55
56 FX_BOOL CBC_Codabar::Encode(const CFX_WideStringC& contents, 56 bool CBC_Codabar::Encode(const CFX_WideStringC& contents,
57 FX_BOOL isDevice, 57 bool isDevice,
58 int32_t& e) { 58 int32_t& e) {
59 if (contents.IsEmpty()) { 59 if (contents.IsEmpty()) {
60 e = BCExceptionNoContents; 60 e = BCExceptionNoContents;
61 return FALSE; 61 return false;
62 } 62 }
63 BCFORMAT format = BCFORMAT_CODABAR; 63 BCFORMAT format = BCFORMAT_CODABAR;
64 int32_t outWidth = 0; 64 int32_t outWidth = 0;
65 int32_t outHeight = 0; 65 int32_t outHeight = 0;
66 CFX_WideString filtercontents = 66 CFX_WideString filtercontents =
67 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 67 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
68 ->FilterContents(contents); 68 ->FilterContents(contents);
69 CFX_ByteString byteString = filtercontents.UTF8Encode(); 69 CFX_ByteString byteString = filtercontents.UTF8Encode();
70 m_renderContents = filtercontents; 70 m_renderContents = filtercontents;
71 uint8_t* data = static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 71 uint8_t* data = static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
72 ->Encode(byteString, format, outWidth, outHeight, e); 72 ->Encode(byteString, format, outWidth, outHeight, e);
73 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 73 BC_EXCEPTION_CHECK_ReturnValue(e, false);
74 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 74 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
75 ->RenderResult(filtercontents.AsStringC(), data, outWidth, isDevice, e); 75 ->RenderResult(filtercontents.AsStringC(), data, outWidth, isDevice, e);
76 FX_Free(data); 76 FX_Free(data);
77 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 77 BC_EXCEPTION_CHECK_ReturnValue(e, false);
78 return TRUE; 78 return true;
79 } 79 }
80 80
81 FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, 81 bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
82 const CFX_Matrix* matrix, 82 const CFX_Matrix* matrix,
83 int32_t& e) { 83 int32_t& e) {
84 CFX_WideString renderCon = 84 CFX_WideString renderCon =
85 static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 85 static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
86 ->encodedContents(m_renderContents.AsStringC()); 86 ->encodedContents(m_renderContents.AsStringC());
87 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 87 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
88 ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e); 88 ->RenderDeviceResult(device, matrix, renderCon.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 FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { 93 bool CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
94 CFX_WideString renderCon = 94 CFX_WideString renderCon =
95 static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get()) 95 static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter.get())
96 ->encodedContents(m_renderContents.AsStringC()); 96 ->encodedContents(m_renderContents.AsStringC());
97 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get()) 97 static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
98 ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e); 98 ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
99 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); 99 BC_EXCEPTION_CHECK_ReturnValue(e, false);
100 return TRUE; 100 return true;
101 } 101 }
102 102
103 BC_TYPE CBC_Codabar::GetType() { 103 BC_TYPE CBC_Codabar::GetType() {
104 return BC_CODABAR; 104 return BC_CODABAR;
105 } 105 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/cbc_codabar.h ('k') | xfa/fxbarcode/cbc_code128.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698