| 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 2010 ZXing authors | 8 * Copyright 2010 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 atLeastOneBlackPointFoundOnBorder = TRUE; | 122 atLeastOneBlackPointFoundOnBorder = TRUE; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) { | 125 if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) { |
| 126 int32_t maxSize = right - left; | 126 int32_t maxSize = right - left; |
| 127 CBC_AutoPtr<CBC_ResultPoint> z(NULL); | 127 CBC_AutoPtr<CBC_ResultPoint> z(NULL); |
| 128 for (int32_t i = 1; i < maxSize; i++) { | 128 for (int32_t i = 1; i < maxSize; i++) { |
| 129 z = CBC_AutoPtr<CBC_ResultPoint>( | 129 z = CBC_AutoPtr<CBC_ResultPoint>( |
| 130 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i), | 130 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i), |
| 131 (FX_FLOAT)(left + i), (FX_FLOAT)(down))); | 131 (FX_FLOAT)(left + i), (FX_FLOAT)(down))); |
| 132 if (z.get() != NULL) { | 132 if (z.get()) { |
| 133 break; | 133 break; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 if (z.get() == NULL) { | 136 if (z.get() == NULL) { |
| 137 e = BCExceptionNotFound; | 137 e = BCExceptionNotFound; |
| 138 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 138 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 139 } | 139 } |
| 140 CBC_AutoPtr<CBC_ResultPoint> t(NULL); | 140 CBC_AutoPtr<CBC_ResultPoint> t(NULL); |
| 141 for (int32_t j = 1; j < maxSize; j++) { | 141 for (int32_t j = 1; j < maxSize; j++) { |
| 142 t = CBC_AutoPtr<CBC_ResultPoint>( | 142 t = CBC_AutoPtr<CBC_ResultPoint>( |
| 143 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j), | 143 GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j), |
| 144 (FX_FLOAT)(left + j), (FX_FLOAT)up)); | 144 (FX_FLOAT)(left + j), (FX_FLOAT)up)); |
| 145 if (t.get() != NULL) { | 145 if (t.get()) { |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 if (t.get() == NULL) { | 149 if (t.get() == NULL) { |
| 150 e = BCExceptionNotFound; | 150 e = BCExceptionNotFound; |
| 151 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 151 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 152 } | 152 } |
| 153 CBC_AutoPtr<CBC_ResultPoint> x(NULL); | 153 CBC_AutoPtr<CBC_ResultPoint> x(NULL); |
| 154 for (int32_t k = 1; k < maxSize; k++) { | 154 for (int32_t k = 1; k < maxSize; k++) { |
| 155 x = CBC_AutoPtr<CBC_ResultPoint>( | 155 x = CBC_AutoPtr<CBC_ResultPoint>( |
| 156 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k), | 156 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k), |
| 157 (FX_FLOAT)(right - k), (FX_FLOAT)up)); | 157 (FX_FLOAT)(right - k), (FX_FLOAT)up)); |
| 158 if (x.get() != NULL) { | 158 if (x.get()) { |
| 159 break; | 159 break; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 if (x.get() == NULL) { | 162 if (x.get() == NULL) { |
| 163 e = BCExceptionNotFound; | 163 e = BCExceptionNotFound; |
| 164 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 164 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 165 } | 165 } |
| 166 CBC_AutoPtr<CBC_ResultPoint> y(NULL); | 166 CBC_AutoPtr<CBC_ResultPoint> y(NULL); |
| 167 for (int32_t m = 1; m < maxSize; m++) { | 167 for (int32_t m = 1; m < maxSize; m++) { |
| 168 y = CBC_AutoPtr<CBC_ResultPoint>( | 168 y = CBC_AutoPtr<CBC_ResultPoint>( |
| 169 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m), | 169 GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m), |
| 170 (FX_FLOAT)(right - m), (FX_FLOAT)down)); | 170 (FX_FLOAT)(right - m), (FX_FLOAT)down)); |
| 171 if (y.get() != NULL) { | 171 if (y.get()) { |
| 172 break; | 172 break; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 if (y.get() == NULL) { | 175 if (y.get() == NULL) { |
| 176 e = BCExceptionNotFound; | 176 e = BCExceptionNotFound; |
| 177 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 177 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 178 } | 178 } |
| 179 return CenterEdges(y.get(), z.get(), x.get(), t.get()); | 179 return CenterEdges(y.get(), z.get(), x.get(), t.get()); |
| 180 } else { | 180 } else { |
| 181 e = BCExceptionNotFound; | 181 e = BCExceptionNotFound; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 } else { | 254 } else { |
| 255 for (int32_t y = a; y <= b; y++) { | 255 for (int32_t y = a; y <= b; y++) { |
| 256 if (m_image->Get(fixed, y)) { | 256 if (m_image->Get(fixed, y)) { |
| 257 return TRUE; | 257 return TRUE; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 return FALSE; | 261 return FALSE; |
| 262 } | 262 } |
| OLD | NEW |