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