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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 int32_t dist = DistanceL2(aX, aY, bX, bY); | 190 int32_t dist = DistanceL2(aX, aY, bX, bY); |
191 float xStep = (bX - aX) / dist; | 191 float xStep = (bX - aX) / dist; |
192 float yStep = (bY - aY) / dist; | 192 float yStep = (bY - aY) / dist; |
193 for (int32_t i = 0; i < dist; i++) { | 193 for (int32_t i = 0; i < dist; i++) { |
194 int32_t x = Round(aX + i * xStep); | 194 int32_t x = Round(aX + i * xStep); |
195 int32_t y = Round(aY + i * yStep); | 195 int32_t y = Round(aY + i * yStep); |
196 if (m_image->Get(x, y)) { | 196 if (m_image->Get(x, y)) { |
197 return new CBC_ResultPoint((FX_FLOAT)x, (FX_FLOAT)y); | 197 return new CBC_ResultPoint((FX_FLOAT)x, (FX_FLOAT)y); |
198 } | 198 } |
199 } | 199 } |
200 return NULL; | 200 return nullptr; |
201 } | 201 } |
202 int32_t CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX, | 202 int32_t CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX, |
203 FX_FLOAT aY, | 203 FX_FLOAT aY, |
204 FX_FLOAT bX, | 204 FX_FLOAT bX, |
205 FX_FLOAT bY) { | 205 FX_FLOAT bY) { |
206 float xDiff = aX - bX; | 206 float xDiff = aX - bX; |
207 float yDiff = aY - bY; | 207 float yDiff = aY - bY; |
208 return Round((float)sqrt(xDiff * xDiff + yDiff * yDiff)); | 208 return Round((float)sqrt(xDiff * xDiff + yDiff * yDiff)); |
209 } | 209 } |
210 | 210 |
(...skipping 42 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 |