| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 BCFORMAT format = BCFORMAT_CODE_39; | 206 BCFORMAT format = BCFORMAT_CODE_39; |
| 207 int32_t outWidth = 0; | 207 int32_t outWidth = 0; |
| 208 int32_t outHeight = 0; | 208 int32_t outHeight = 0; |
| 209 CFX_WideString filtercontents = | 209 CFX_WideString filtercontents = |
| 210 ((CBC_OnedCode39Writer*)m_pBCWriter)->FilterContents(contents); | 210 ((CBC_OnedCode39Writer*)m_pBCWriter)->FilterContents(contents); |
| 211 CFX_WideString renderContents = | 211 CFX_WideString renderContents = |
| 212 ((CBC_OnedCode39Writer*)m_pBCWriter)->RenderTextContents(contents); | 212 ((CBC_OnedCode39Writer*)m_pBCWriter)->RenderTextContents(contents); |
| 213 m_renderContents = renderContents; | 213 m_renderContents = renderContents; |
| 214 CFX_ByteString byteString = filtercontents.UTF8Encode(); | 214 CFX_ByteString byteString = filtercontents.UTF8Encode(); |
| 215 uint8_t* data = | 215 uint8_t* data = static_cast<CBC_OnedCode39Writer*>(m_pBCWriter) |
| 216 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 216 ->Encode(byteString, format, outWidth, outHeight, e); |
| 217 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 217 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 218 ((CBC_OneDimWriter*)m_pBCWriter) | 218 ((CBC_OneDimWriter*)m_pBCWriter) |
| 219 ->RenderResult(renderContents, data, outWidth, isDevice, e); | 219 ->RenderResult(renderContents, data, outWidth, isDevice, e); |
| 220 FX_Free(data); | 220 FX_Free(data); |
| 221 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 221 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 222 return TRUE; | 222 return TRUE; |
| 223 } | 223 } |
| 224 FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device, | 224 FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device, |
| 225 const CFX_Matrix* matirx, | 225 const CFX_Matrix* matirx, |
| 226 int32_t& e) { | 226 int32_t& e) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 e = BCExceptionNoContents; | 308 e = BCExceptionNoContents; |
| 309 return FALSE; | 309 return FALSE; |
| 310 } | 310 } |
| 311 BCFORMAT format = BCFORMAT_CODABAR; | 311 BCFORMAT format = BCFORMAT_CODABAR; |
| 312 int32_t outWidth = 0; | 312 int32_t outWidth = 0; |
| 313 int32_t outHeight = 0; | 313 int32_t outHeight = 0; |
| 314 CFX_WideString filtercontents = | 314 CFX_WideString filtercontents = |
| 315 ((CBC_OneDimWriter*)m_pBCWriter)->FilterContents(contents); | 315 ((CBC_OneDimWriter*)m_pBCWriter)->FilterContents(contents); |
| 316 CFX_ByteString byteString = filtercontents.UTF8Encode(); | 316 CFX_ByteString byteString = filtercontents.UTF8Encode(); |
| 317 m_renderContents = filtercontents; | 317 m_renderContents = filtercontents; |
| 318 uint8_t* data = | 318 uint8_t* data = static_cast<CBC_OnedCodaBarWriter*>(m_pBCWriter) |
| 319 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 319 ->Encode(byteString, format, outWidth, outHeight, e); |
| 320 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 320 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 321 ((CBC_OneDimWriter*)m_pBCWriter) | 321 ((CBC_OneDimWriter*)m_pBCWriter) |
| 322 ->RenderResult(filtercontents, data, outWidth, isDevice, e); | 322 ->RenderResult(filtercontents, data, outWidth, isDevice, e); |
| 323 FX_Free(data); | 323 FX_Free(data); |
| 324 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 324 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 325 return TRUE; | 325 return TRUE; |
| 326 } | 326 } |
| 327 FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, | 327 FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, |
| 328 const CFX_Matrix* matirx, | 328 const CFX_Matrix* matirx, |
| 329 int32_t& e) { | 329 int32_t& e) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 int32_t outHeight = 0; | 389 int32_t outHeight = 0; |
| 390 CFX_WideString content = contents; | 390 CFX_WideString content = contents; |
| 391 if (contents.GetLength() % 2 && | 391 if (contents.GetLength() % 2 && |
| 392 ((CBC_OnedCode128Writer*)m_pBCWriter)->GetType() == BC_CODE128_C) { | 392 ((CBC_OnedCode128Writer*)m_pBCWriter)->GetType() == BC_CODE128_C) { |
| 393 content += '0'; | 393 content += '0'; |
| 394 } | 394 } |
| 395 CFX_WideString encodeContents = | 395 CFX_WideString encodeContents = |
| 396 ((CBC_OnedCode128Writer*)m_pBCWriter)->FilterContents(content); | 396 ((CBC_OnedCode128Writer*)m_pBCWriter)->FilterContents(content); |
| 397 m_renderContents = encodeContents; | 397 m_renderContents = encodeContents; |
| 398 CFX_ByteString byteString = encodeContents.UTF8Encode(); | 398 CFX_ByteString byteString = encodeContents.UTF8Encode(); |
| 399 uint8_t* data = | 399 uint8_t* data = static_cast<CBC_OnedCode128Writer*>(m_pBCWriter) |
| 400 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 400 ->Encode(byteString, format, outWidth, outHeight, e); |
| 401 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 401 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 402 ((CBC_OneDimWriter*)m_pBCWriter) | 402 ((CBC_OneDimWriter*)m_pBCWriter) |
| 403 ->RenderResult(encodeContents, data, outWidth, isDevice, e); | 403 ->RenderResult(encodeContents, data, outWidth, isDevice, e); |
| 404 FX_Free(data); | 404 FX_Free(data); |
| 405 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 405 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 406 return TRUE; | 406 return TRUE; |
| 407 } | 407 } |
| 408 FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device, | 408 FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device, |
| 409 const CFX_Matrix* matirx, | 409 const CFX_Matrix* matirx, |
| 410 int32_t& e) { | 410 int32_t& e) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (contents.IsEmpty()) { | 472 if (contents.IsEmpty()) { |
| 473 e = BCExceptionNoContents; | 473 e = BCExceptionNoContents; |
| 474 return FALSE; | 474 return FALSE; |
| 475 } | 475 } |
| 476 BCFORMAT format = BCFORMAT_EAN_8; | 476 BCFORMAT format = BCFORMAT_EAN_8; |
| 477 int32_t outWidth = 0; | 477 int32_t outWidth = 0; |
| 478 int32_t outHeight = 0; | 478 int32_t outHeight = 0; |
| 479 CFX_WideString encodeContents = Preprocess(contents); | 479 CFX_WideString encodeContents = Preprocess(contents); |
| 480 CFX_ByteString byteString = encodeContents.UTF8Encode(); | 480 CFX_ByteString byteString = encodeContents.UTF8Encode(); |
| 481 m_renderContents = encodeContents; | 481 m_renderContents = encodeContents; |
| 482 uint8_t* data = | 482 uint8_t* data = static_cast<CBC_OnedEAN8Writer*>(m_pBCWriter) |
| 483 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 483 ->Encode(byteString, format, outWidth, outHeight, e); |
| 484 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 484 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 485 ((CBC_OneDimWriter*)m_pBCWriter) | 485 ((CBC_OneDimWriter*)m_pBCWriter) |
| 486 ->RenderResult(encodeContents, data, outWidth, isDevice, e); | 486 ->RenderResult(encodeContents, data, outWidth, isDevice, e); |
| 487 FX_Free(data); | 487 FX_Free(data); |
| 488 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 488 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 489 return TRUE; | 489 return TRUE; |
| 490 } | 490 } |
| 491 FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device, | 491 FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device, |
| 492 const CFX_Matrix* matirx, | 492 const CFX_Matrix* matirx, |
| 493 int32_t& e) { | 493 int32_t& e) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 if (contents.IsEmpty()) { | 556 if (contents.IsEmpty()) { |
| 557 e = BCExceptionNoContents; | 557 e = BCExceptionNoContents; |
| 558 return FALSE; | 558 return FALSE; |
| 559 } | 559 } |
| 560 BCFORMAT format = BCFORMAT_EAN_13; | 560 BCFORMAT format = BCFORMAT_EAN_13; |
| 561 int32_t outWidth = 0; | 561 int32_t outWidth = 0; |
| 562 int32_t outHeight = 0; | 562 int32_t outHeight = 0; |
| 563 CFX_WideString encodeContents = Preprocess(contents); | 563 CFX_WideString encodeContents = Preprocess(contents); |
| 564 CFX_ByteString byteString = encodeContents.UTF8Encode(); | 564 CFX_ByteString byteString = encodeContents.UTF8Encode(); |
| 565 m_renderContents = encodeContents; | 565 m_renderContents = encodeContents; |
| 566 uint8_t* data = | 566 uint8_t* data = static_cast<CBC_OnedEAN13Writer*>(m_pBCWriter) |
| 567 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 567 ->Encode(byteString, format, outWidth, outHeight, e); |
| 568 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 568 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 569 ((CBC_OneDimWriter*)m_pBCWriter) | 569 ((CBC_OneDimWriter*)m_pBCWriter) |
| 570 ->RenderResult(encodeContents, data, outWidth, isDevice, e); | 570 ->RenderResult(encodeContents, data, outWidth, isDevice, e); |
| 571 FX_Free(data); | 571 FX_Free(data); |
| 572 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 572 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 573 return TRUE; | 573 return TRUE; |
| 574 } | 574 } |
| 575 FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device, | 575 FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device, |
| 576 const CFX_Matrix* matirx, | 576 const CFX_Matrix* matirx, |
| 577 int32_t& e) { | 577 int32_t& e) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 e = BCExceptionNoContents; | 642 e = BCExceptionNoContents; |
| 643 return FALSE; | 643 return FALSE; |
| 644 } | 644 } |
| 645 BCFORMAT format = BCFORMAT_UPC_A; | 645 BCFORMAT format = BCFORMAT_UPC_A; |
| 646 int32_t outWidth = 0; | 646 int32_t outWidth = 0; |
| 647 int32_t outHeight = 0; | 647 int32_t outHeight = 0; |
| 648 CFX_WideString encodeContents = Preprocess(contents); | 648 CFX_WideString encodeContents = Preprocess(contents); |
| 649 CFX_ByteString byteString = encodeContents.UTF8Encode(); | 649 CFX_ByteString byteString = encodeContents.UTF8Encode(); |
| 650 m_renderContents = encodeContents; | 650 m_renderContents = encodeContents; |
| 651 ((CBC_OnedUPCAWriter*)m_pBCWriter)->Init(); | 651 ((CBC_OnedUPCAWriter*)m_pBCWriter)->Init(); |
| 652 uint8_t* data = | 652 uint8_t* data = static_cast<CBC_OnedUPCAWriter*>(m_pBCWriter) |
| 653 m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e); | 653 ->Encode(byteString, format, outWidth, outHeight, e); |
| 654 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 654 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 655 ((CBC_OneDimWriter*)m_pBCWriter) | 655 ((CBC_OneDimWriter*)m_pBCWriter) |
| 656 ->RenderResult(encodeContents, data, outWidth, isDevice, e); | 656 ->RenderResult(encodeContents, data, outWidth, isDevice, e); |
| 657 FX_Free(data); | 657 FX_Free(data); |
| 658 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); | 658 BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); |
| 659 return TRUE; | 659 return TRUE; |
| 660 } | 660 } |
| 661 FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, | 661 FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, |
| 662 const CFX_Matrix* matirx, | 662 const CFX_Matrix* matirx, |
| 663 int32_t& e) { | 663 int32_t& e) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 return str; | 868 return str; |
| 869 } | 869 } |
| 870 CFX_WideString CBC_DataMatrix::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { | 870 CFX_WideString CBC_DataMatrix::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { |
| 871 CBC_BufferedImageLuminanceSource source(pBitmap); | 871 CBC_BufferedImageLuminanceSource source(pBitmap); |
| 872 CBC_GlobalHistogramBinarizer binarizer(&source); | 872 CBC_GlobalHistogramBinarizer binarizer(&source); |
| 873 CBC_BinaryBitmap bitmap(&binarizer); | 873 CBC_BinaryBitmap bitmap(&binarizer); |
| 874 CFX_ByteString retStr = m_pBCReader->Decode(&bitmap, 0, e); | 874 CFX_ByteString retStr = m_pBCReader->Decode(&bitmap, 0, e); |
| 875 BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); | 875 BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); |
| 876 return CFX_WideString::FromUTF8(retStr, retStr.GetLength()); | 876 return CFX_WideString::FromUTF8(retStr, retStr.GetLength()); |
| 877 } | 877 } |
| OLD | NEW |