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 in part, and ZXing Authors in part | 8 * Copyright 2006 Jeremias Maerki in part, and ZXing Authors in part |
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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 int32_t rows = | 546 int32_t rows = |
547 calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); | 547 calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); |
548 if (rows < m_minRows) { | 548 if (rows < m_minRows) { |
549 break; | 549 break; |
550 } | 550 } |
551 if (rows > m_maxRows) { | 551 if (rows > m_maxRows) { |
552 continue; | 552 continue; |
553 } | 553 } |
554 FX_FLOAT newRatio = | 554 FX_FLOAT newRatio = |
555 ((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT); | 555 ((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT); |
556 if (dimension != NULL && | 556 if (dimension && |
557 fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) { | 557 fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) { |
558 continue; | 558 continue; |
559 } | 559 } |
560 ratio = newRatio; | 560 ratio = newRatio; |
561 if (dimension) { | 561 if (dimension) { |
562 delete dimension; | 562 delete dimension; |
563 } | 563 } |
564 dimension = new CFX_Int32Array; | 564 dimension = new CFX_Int32Array; |
565 dimension->Add(cols); | 565 dimension->Add(cols); |
566 dimension->Add(rows); | 566 dimension->Add(rows); |
(...skipping 10 matching lines...) Expand all Loading... |
577 dimension->Add(m_minCols); | 577 dimension->Add(m_minCols); |
578 dimension->Add(rows); | 578 dimension->Add(rows); |
579 } | 579 } |
580 } | 580 } |
581 if (dimension == NULL) { | 581 if (dimension == NULL) { |
582 e = BCExceptionUnableToFitMessageInColumns; | 582 e = BCExceptionUnableToFitMessageInColumns; |
583 return NULL; | 583 return NULL; |
584 } | 584 } |
585 return dimension; | 585 return dimension; |
586 } | 586 } |
OLD | NEW |