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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image, | 88 CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image, |
89 int32_t hints, | 89 int32_t hints, |
90 int32_t& e) { | 90 int32_t& e) { |
91 CFX_ByteString bs = Decode(image, FALSE, 0, e); | 91 CFX_ByteString bs = Decode(image, FALSE, 0, e); |
92 BC_EXCEPTION_CHECK_ReturnValue(e, ""); | 92 BC_EXCEPTION_CHECK_ReturnValue(e, ""); |
93 return bs; | 93 return bs; |
94 } | 94 } |
95 int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, | 95 int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, |
96 CBC_ResultPoint* p2) { | 96 CBC_ResultPoint* p2) { |
97 if (p1 == NULL || p2 == NULL) { | 97 if (!p1 || !p2) |
98 return 0; | 98 return 0; |
99 } | |
100 return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX()); | 99 return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX()); |
101 } | 100 } |
102 int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, | 101 int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, |
103 CBC_ResultPoint* p2) { | 102 CBC_ResultPoint* p2) { |
104 if (!p1 || !p2) | 103 if (!p1 || !p2) |
105 return std::numeric_limits<int32_t>::max(); | 104 return std::numeric_limits<int32_t>::max(); |
106 return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX()); | 105 return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX()); |
107 } | 106 } |
108 | 107 |
109 int32_t CBC_PDF417Reader::getMaxCodewordWidth( | 108 int32_t CBC_PDF417Reader::getMaxCodewordWidth( |
(...skipping 14 matching lines...) Expand all Loading... |
124 int32_t a = getMinWidth(p.GetAt(6), p.GetAt(2)) * | 123 int32_t a = getMinWidth(p.GetAt(6), p.GetAt(2)) * |
125 CBC_PDF417Common::MODULES_IN_CODEWORD / | 124 CBC_PDF417Common::MODULES_IN_CODEWORD / |
126 CBC_PDF417Common::MODULES_IN_STOP_PATTERN; | 125 CBC_PDF417Common::MODULES_IN_STOP_PATTERN; |
127 int32_t b = getMinWidth(p.GetAt(7), p.GetAt(3)) * | 126 int32_t b = getMinWidth(p.GetAt(7), p.GetAt(3)) * |
128 CBC_PDF417Common::MODULES_IN_CODEWORD / | 127 CBC_PDF417Common::MODULES_IN_CODEWORD / |
129 CBC_PDF417Common::MODULES_IN_STOP_PATTERN; | 128 CBC_PDF417Common::MODULES_IN_STOP_PATTERN; |
130 int32_t c = std::min(a, getMinWidth(p.GetAt(0), p.GetAt(4))); | 129 int32_t c = std::min(a, getMinWidth(p.GetAt(0), p.GetAt(4))); |
131 int32_t d = std::min(b, getMinWidth(p.GetAt(1), p.GetAt(5))); | 130 int32_t d = std::min(b, getMinWidth(p.GetAt(1), p.GetAt(5))); |
132 return std::min(c, d); | 131 return std::min(c, d); |
133 } | 132 } |
OLD | NEW |