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 | 6 |
7 #include <setjmp.h> | 7 #include <setjmp.h> |
8 | 8 |
9 #include "core/fxcodec/codec/codec_int.h" | 9 #include "core/fxcodec/codec/codec_int.h" |
10 #include "core/fxcodec/include/fx_codec.h" | 10 #include "core/fxcodec/include/fx_codec.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1); | 470 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1); |
471 if (nlines < 1) { | 471 if (nlines < 1) { |
472 return nullptr; | 472 return nullptr; |
473 } | 473 } |
474 return m_pScanlineBuf; | 474 return m_pScanlineBuf; |
475 } | 475 } |
476 uint32_t CCodec_JpegDecoder::GetSrcOffset() { | 476 uint32_t CCodec_JpegDecoder::GetSrcOffset() { |
477 return (uint32_t)(m_SrcSize - src.bytes_in_buffer); | 477 return (uint32_t)(m_SrcSize - src.bytes_in_buffer); |
478 } | 478 } |
479 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( | 479 CCodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( |
480 const uint8_t* src_buf, | 480 const uint8_t* src_buf, |
481 uint32_t src_size, | 481 uint32_t src_size, |
482 int width, | 482 int width, |
483 int height, | 483 int height, |
484 int nComps, | 484 int nComps, |
485 FX_BOOL ColorTransform) { | 485 FX_BOOL ColorTransform) { |
486 if (!src_buf || src_size == 0) { | 486 if (!src_buf || src_size == 0) { |
487 return NULL; | 487 return NULL; |
488 } | 488 } |
489 CCodec_JpegDecoder* pDecoder = new CCodec_JpegDecoder; | 489 CCodec_JpegDecoder* pDecoder = new CCodec_JpegDecoder; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 uint8_t** avail_buf_ptr) { | 650 uint8_t** avail_buf_ptr) { |
651 if (avail_buf_ptr) { | 651 if (avail_buf_ptr) { |
652 *avail_buf_ptr = NULL; | 652 *avail_buf_ptr = NULL; |
653 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { | 653 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { |
654 *avail_buf_ptr = | 654 *avail_buf_ptr = |
655 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; | 655 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; |
656 } | 656 } |
657 } | 657 } |
658 return (uint32_t)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; | 658 return (uint32_t)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; |
659 } | 659 } |
OLD | NEW |