| 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 "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "../../../include/fxcrt/fx_safe_types.h" | 10 #include "../../../include/fxcrt/fx_safe_types.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 return TRUE; | 413 return TRUE; |
| 414 } | 414 } |
| 415 extern "C" { | 415 extern "C" { |
| 416 int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int
32_t downsampleWidth, int32_t downsampleHeight) | 416 int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int
32_t downsampleWidth, int32_t downsampleHeight) |
| 417 { | 417 { |
| 418 int iratio_w = originWidth / downsampleWidth; | 418 int iratio_w = originWidth / downsampleWidth; |
| 419 int iratio_h = originHeight / downsampleHeight; | 419 int iratio_h = originHeight / downsampleHeight; |
| 420 int ratio = (iratio_w > iratio_h) ? iratio_h : iratio_w; | 420 int ratio = (iratio_w > iratio_h) ? iratio_h : iratio_w; |
| 421 if (ratio >= 8) { | 421 if (ratio >= 8) { |
| 422 return 8; | 422 return 8; |
| 423 } else if (ratio >= 4) { | 423 } |
| 424 if (ratio >= 4) { |
| 424 return 4; | 425 return 4; |
| 425 } else if (ratio >= 2) { | 426 } |
| 427 if (ratio >= 2) { |
| 426 return 2; | 428 return 2; |
| 427 } | 429 } |
| 428 return 1; | 430 return 1; |
| 429 } | 431 } |
| 430 } | 432 } |
| 431 void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) | 433 void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) |
| 432 { | 434 { |
| 433 if (m_pExtProvider) { | 435 if (m_pExtProvider) { |
| 434 m_pExtProvider->DownScale(m_pExtContext, dest_width, dest_height); | 436 m_pExtProvider->DownScale(m_pExtContext, dest_width, dest_height); |
| 435 return; | 437 return; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); | 671 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); |
| 670 } | 672 } |
| 671 if(avail_buf_ptr != NULL) { | 673 if(avail_buf_ptr != NULL) { |
| 672 *avail_buf_ptr = NULL; | 674 *avail_buf_ptr = NULL; |
| 673 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { | 675 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { |
| 674 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex
t_input_byte; | 676 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex
t_input_byte; |
| 675 } | 677 } |
| 676 } | 678 } |
| 677 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; | 679 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; |
| 678 } | 680 } |
| OLD | NEW |