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 2007 ZXing authors | 8 * Copyright 2007 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int32_t currentState = 0; | 66 int32_t currentState = 0; |
67 while (j < maxJ) { | 67 while (j < maxJ) { |
68 if (m_image->Get(j, i)) { | 68 if (m_image->Get(j, i)) { |
69 if (currentState == 1) { | 69 if (currentState == 1) { |
70 stateCount[currentState]++; | 70 stateCount[currentState]++; |
71 } else { | 71 } else { |
72 if (currentState == 2) { | 72 if (currentState == 2) { |
73 if (FoundPatternCross(stateCount)) { | 73 if (FoundPatternCross(stateCount)) { |
74 CBC_QRAlignmentPattern* confirmed = | 74 CBC_QRAlignmentPattern* confirmed = |
75 HandlePossibleCenter(stateCount, i, j); | 75 HandlePossibleCenter(stateCount, i, j); |
76 if (confirmed != NULL) { | 76 if (confirmed) { |
77 return confirmed; | 77 return confirmed; |
78 } | 78 } |
79 } | 79 } |
80 stateCount[0] = stateCount[2]; | 80 stateCount[0] = stateCount[2]; |
81 stateCount[1] = 1; | 81 stateCount[1] = 1; |
82 stateCount[2] = 0; | 82 stateCount[2] = 0; |
83 currentState = 1; | 83 currentState = 1; |
84 } else { | 84 } else { |
85 stateCount[++currentState]++; | 85 stateCount[++currentState]++; |
86 } | 86 } |
87 } | 87 } |
88 } else { | 88 } else { |
89 if (currentState == 1) { | 89 if (currentState == 1) { |
90 currentState++; | 90 currentState++; |
91 } | 91 } |
92 stateCount[currentState]++; | 92 stateCount[currentState]++; |
93 } | 93 } |
94 j++; | 94 j++; |
95 } | 95 } |
96 if (FoundPatternCross(stateCount)) { | 96 if (FoundPatternCross(stateCount)) { |
97 CBC_QRAlignmentPattern* confirmed = | 97 CBC_QRAlignmentPattern* confirmed = |
98 HandlePossibleCenter(stateCount, i, maxJ); | 98 HandlePossibleCenter(stateCount, i, maxJ); |
99 if (confirmed != NULL) { | 99 if (confirmed) { |
100 return confirmed; | 100 return confirmed; |
101 } | 101 } |
102 } | 102 } |
103 } | 103 } |
104 if (m_possibleCenters.GetSize() != 0) { | 104 if (m_possibleCenters.GetSize() != 0) { |
105 return ((CBC_QRAlignmentPattern*)(m_possibleCenters[0]))->Clone(); | 105 return ((CBC_QRAlignmentPattern*)(m_possibleCenters[0]))->Clone(); |
106 } | 106 } |
107 e = BCExceptionRead; | 107 e = BCExceptionRead; |
108 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 108 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
109 return NULL; | 109 return NULL; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) { | 191 if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) { |
192 return new CBC_QRAlignmentPattern(centerJ, centerI, | 192 return new CBC_QRAlignmentPattern(centerJ, centerI, |
193 estimatedModuleSize); | 193 estimatedModuleSize); |
194 } | 194 } |
195 } | 195 } |
196 m_possibleCenters.Add( | 196 m_possibleCenters.Add( |
197 new CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize)); | 197 new CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize)); |
198 } | 198 } |
199 return NULL; | 199 return NULL; |
200 } | 200 } |
OLD | NEW |