| 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 2011 ZXing authors | 8 * Copyright 2011 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, | 95 uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, |
| 96 BCFORMAT format, | 96 BCFORMAT format, |
| 97 int32_t& outWidth, | 97 int32_t& outWidth, |
| 98 int32_t& outHeight, | 98 int32_t& outHeight, |
| 99 int32_t& e) { | 99 int32_t& e) { |
| 100 uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); | 100 uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); |
| 101 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); | 101 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 102 return ret; | 102 return ret; |
| 103 } | 103 } |
| 104 |
| 105 uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, |
| 106 int32_t& outLength, |
| 107 int32_t& e) { |
| 108 return nullptr; |
| 109 } |
| 110 |
| 104 int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, | 111 int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, |
| 105 int32_t pos, | 112 int32_t pos, |
| 106 const int32_t* pattern, | 113 const int32_t* pattern, |
| 107 int32_t patternLength, | 114 int32_t patternLength, |
| 108 int32_t startColor, | 115 int32_t startColor, |
| 109 int32_t& e) { | 116 int32_t& e) { |
| 110 if (startColor != 0 && startColor != 1) { | 117 if (startColor != 0 && startColor != 1) { |
| 111 e = BCExceptionValueMustBeEither0or1; | 118 e = BCExceptionValueMustBeEither0or1; |
| 112 return 0; | 119 return 0; |
| 113 } | 120 } |
| 114 uint8_t color = (uint8_t)startColor; | 121 uint8_t color = (uint8_t)startColor; |
| 115 int32_t numAdded = 0; | 122 int32_t numAdded = 0; |
| 116 for (int32_t i = 0; i < patternLength; i++) { | 123 for (int32_t i = 0; i < patternLength; i++) { |
| 117 for (int32_t j = 0; j < pattern[i]; j++) { | 124 for (int32_t j = 0; j < pattern[i]; j++) { |
| 118 target[pos] = color; | 125 target[pos] = color; |
| 119 pos += 1; | 126 pos += 1; |
| 120 numAdded += 1; | 127 numAdded += 1; |
| 121 } | 128 } |
| 122 color ^= 1; | 129 color ^= 1; |
| 123 } | 130 } |
| 124 return numAdded; | 131 return numAdded; |
| 125 } | 132 } |
| 133 |
| 126 void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, | 134 void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, |
| 127 FXTEXT_CHARPOS* charPos, | 135 FXTEXT_CHARPOS* charPos, |
| 128 CFX_Font* cFont, | 136 CFX_Font* cFont, |
| 129 FX_FLOAT geWidth, | 137 FX_FLOAT geWidth, |
| 130 int32_t fontSize, | 138 int32_t fontSize, |
| 131 FX_FLOAT& charsLen) { | 139 FX_FLOAT& charsLen) { |
| 132 std::unique_ptr<CFX_UnicodeEncodingEx> encoding( | 140 std::unique_ptr<CFX_UnicodeEncodingEx> encoding( |
| 133 FX_CreateFontEncodingEx(cFont)); | 141 FX_CreateFontEncodingEx(cFont)); |
| 134 | 142 |
| 135 int32_t length = text.GetLength(); | 143 int32_t length = text.GetLength(); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 int32_t i = 0; | 362 int32_t i = 0; |
| 355 for (; i < contents.GetLength(); i++) | 363 for (; i < contents.GetLength(); i++) |
| 356 if (contents.GetAt(i) != ' ') { | 364 if (contents.GetAt(i) != ' ') { |
| 357 break; | 365 break; |
| 358 } | 366 } |
| 359 if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { | 367 if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { |
| 360 ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e); | 368 ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e); |
| 361 BC_EXCEPTION_CHECK_ReturnVoid(e); | 369 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 362 } | 370 } |
| 363 } | 371 } |
| 372 |
| 364 void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents, | 373 void CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents, |
| 365 uint8_t* code, | 374 uint8_t* code, |
| 366 int32_t codeLength, | 375 int32_t codeLength, |
| 367 FX_BOOL isDevice, | 376 FX_BOOL isDevice, |
| 368 int32_t& e) { | 377 int32_t& e) { |
| 369 if (codeLength < 1) { | 378 if (codeLength < 1) { |
| 370 BC_EXCEPTION_CHECK_ReturnVoid(e); | 379 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 371 } | 380 } |
| 372 if (m_ModuleHeight < 20.0) { | 381 if (m_ModuleHeight < 20.0) { |
| 373 m_ModuleHeight = 20; | 382 m_ModuleHeight = 20; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { | 438 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { |
| 430 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); | 439 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); |
| 431 break; | 440 break; |
| 432 } | 441 } |
| 433 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); | 442 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); |
| 434 BC_EXCEPTION_CHECK_ReturnVoid(e); | 443 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 435 } | 444 } |
| 436 outputX += m_multiple; | 445 outputX += m_multiple; |
| 437 } | 446 } |
| 438 } | 447 } |
| 448 |
| 449 FX_BOOL CBC_OneDimWriter::CheckContentValidity( |
| 450 const CFX_WideStringC& contents) { |
| 451 return TRUE; |
| 452 } |
| 453 |
| 454 CFX_WideString CBC_OneDimWriter::FilterContents( |
| 455 const CFX_WideStringC& contents) { |
| 456 return CFX_WideString(); |
| 457 } |
| 458 |
| 459 CFX_WideString CBC_OneDimWriter::RenderTextContents( |
| 460 const CFX_WideStringC& contents) { |
| 461 return CFX_WideString(); |
| 462 } |
| OLD | NEW |