| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 return TRUE; | 486 return TRUE; |
| 487 } | 487 } |
| 488 extern "C" { | 488 extern "C" { |
| 489 int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int
32_t downsampleWidth, int32_t downsampleHeight) | 489 int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int
32_t downsampleWidth, int32_t downsampleHeight) |
| 490 { | 490 { |
| 491 int iratio_w = originWidth / downsampleWidth; | 491 int iratio_w = originWidth / downsampleWidth; |
| 492 int iratio_h = originHeight / downsampleHeight; | 492 int iratio_h = originHeight / downsampleHeight; |
| 493 int ratio = (iratio_w > iratio_h) ? iratio_h : iratio_w; | 493 int ratio = (iratio_w > iratio_h) ? iratio_h : iratio_w; |
| 494 if (ratio >= 8) { | 494 if (ratio >= 8) { |
| 495 return 8; | 495 return 8; |
| 496 } else if (ratio >= 4) { | 496 } |
| 497 if (ratio >= 4) { |
| 497 return 4; | 498 return 4; |
| 498 } else if (ratio >= 2) { | 499 } |
| 500 if (ratio >= 2) { |
| 499 return 2; | 501 return 2; |
| 500 } | 502 } |
| 501 return 1; | 503 return 1; |
| 502 } | 504 } |
| 503 } | 505 } |
| 504 void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) | 506 void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) |
| 505 { | 507 { |
| 506 if (m_pExtProvider) { | 508 if (m_pExtProvider) { |
| 507 m_pExtProvider->DownScale(m_pExtContext, dest_width, dest_height); | 509 m_pExtProvider->DownScale(m_pExtContext, dest_width, dest_height); |
| 508 return; | 510 return; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); | 745 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); |
| 744 } | 746 } |
| 745 if(avail_buf_ptr != NULL) { | 747 if(avail_buf_ptr != NULL) { |
| 746 *avail_buf_ptr = NULL; | 748 *avail_buf_ptr = NULL; |
| 747 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { | 749 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { |
| 748 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex
t_input_byte; | 750 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex
t_input_byte; |
| 749 } | 751 } |
| 750 } | 752 } |
| 751 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; | 753 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; |
| 752 } | 754 } |
| OLD | NEW |