| 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 "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
| 8 #include "../../../include/fxge/fx_dib.h" | 8 #include "../../../include/fxge/fx_dib.h" |
| 9 #include "codec_int.h" | 9 #include "codec_int.h" |
| 10 extern "C" { | 10 extern "C" { |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return m_pExtProvider->GetSrcOffset(m_pExtContext); | 477 return m_pExtProvider->GetSrcOffset(m_pExtContext); |
| 478 } | 478 } |
| 479 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); | 479 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); |
| 480 } | 480 } |
| 481 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_
DWORD src_size, | 481 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_
DWORD src_size, |
| 482 int width, int height, int nComps, FX_BOOL ColorTransform) | 482 int width, int height, int nComps, FX_BOOL ColorTransform) |
| 483 { | 483 { |
| 484 if (src_buf == NULL || src_size == 0) { | 484 if (src_buf == NULL || src_size == 0) { |
| 485 return NULL; | 485 return NULL; |
| 486 } | 486 } |
| 487 CCodec_JpegDecoder* pDecoder = FX_NEW CCodec_JpegDecoder; | 487 CCodec_JpegDecoder* pDecoder = new CCodec_JpegDecoder; |
| 488 if (pDecoder == NULL) { | |
| 489 return NULL; | |
| 490 } | |
| 491 if (!pDecoder->Create(src_buf, src_size, width, height, nComps, ColorTransfo
rm, m_pExtProvider)) { | 488 if (!pDecoder->Create(src_buf, src_size, width, height, nComps, ColorTransfo
rm, m_pExtProvider)) { |
| 492 delete pDecoder; | 489 delete pDecoder; |
| 493 return NULL; | 490 return NULL; |
| 494 } | 491 } |
| 495 return pDecoder; | 492 return pDecoder; |
| 496 } | 493 } |
| 497 FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int&
width, int& height, | 494 FX_BOOL CCodec_JpegModule::LoadInfo(FX_LPCBYTE src_buf, FX_DWORD src_size, int&
width, int& height, |
| 498 int& num_components, int& bits_per_component
s, FX_BOOL& color_transform, | 495 int& num_components, int& bits_per_component
s, FX_BOOL& color_transform, |
| 499 FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length
) | 496 FX_LPBYTE* icc_buf_ptr, FX_DWORD* icc_length
) |
| 500 { | 497 { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); | 661 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); |
| 665 } | 662 } |
| 666 if(avail_buf_ptr != NULL) { | 663 if(avail_buf_ptr != NULL) { |
| 667 *avail_buf_ptr = NULL; | 664 *avail_buf_ptr = NULL; |
| 668 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { | 665 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { |
| 669 *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.ne
xt_input_byte; | 666 *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.ne
xt_input_byte; |
| 670 } | 667 } |
| 671 } | 668 } |
| 672 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; | 669 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; |
| 673 } | 670 } |
| OLD | NEW |