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 2006 Jeremias Maerki | 8 * Copyright 2006 Jeremias Maerki |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 FX_BOOL fail, | 143 FX_BOOL fail, |
144 int32_t& e) { | 144 int32_t& e) { |
145 for (int32_t i = 0; i < SYMBOLS_COUNT; i++) { | 145 for (int32_t i = 0; i < SYMBOLS_COUNT; i++) { |
146 CBC_SymbolInfo* symbol = m_symbols[i]; | 146 CBC_SymbolInfo* symbol = m_symbols[i]; |
147 if (shape == FORCE_SQUARE && symbol->m_rectangular) { | 147 if (shape == FORCE_SQUARE && symbol->m_rectangular) { |
148 continue; | 148 continue; |
149 } | 149 } |
150 if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) { | 150 if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) { |
151 continue; | 151 continue; |
152 } | 152 } |
153 if (minSize != NULL && | 153 if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() || |
154 (symbol->getSymbolWidth(e) < minSize->getWidth() || | 154 symbol->getSymbolHeight(e) < minSize->getHeight())) { |
155 symbol->getSymbolHeight(e) < minSize->getHeight())) { | |
156 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 155 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
157 continue; | 156 continue; |
158 } | 157 } |
159 if (maxSize != NULL && | 158 if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() || |
160 (symbol->getSymbolWidth(e) > maxSize->getWidth() || | 159 symbol->getSymbolHeight(e) > maxSize->getHeight())) { |
161 symbol->getSymbolHeight(e) > maxSize->getHeight())) { | |
162 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 160 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
163 continue; | 161 continue; |
164 } | 162 } |
165 if (dataCodewords <= symbol->m_dataCapacity) { | 163 if (dataCodewords <= symbol->m_dataCapacity) { |
166 return symbol; | 164 return symbol; |
167 } | 165 } |
168 } | 166 } |
169 if (fail) { | 167 if (fail) { |
170 e = BCExceptionIllegalDataCodewords; | 168 e = BCExceptionIllegalDataCodewords; |
171 return NULL; | 169 return NULL; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); | 246 BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); |
249 sb += (FX_WCHAR)'x'; | 247 sb += (FX_WCHAR)'x'; |
250 sb += getSymbolDataHeight(e); | 248 sb += getSymbolDataHeight(e); |
251 BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); | 249 BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)""); |
252 sb += (FX_WCHAR*)", codewords "; | 250 sb += (FX_WCHAR*)", codewords "; |
253 sb += m_dataCapacity; | 251 sb += m_dataCapacity; |
254 sb += (FX_WCHAR)'+'; | 252 sb += (FX_WCHAR)'+'; |
255 sb += m_errorCodewords; | 253 sb += m_errorCodewords; |
256 return sb; | 254 return sb; |
257 } | 255 } |
OLD | NEW |