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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 } | 227 } |
228 jpeg_finish_compress(&cinfo); | 228 jpeg_finish_compress(&cinfo); |
229 jpeg_destroy_compress(&cinfo); | 229 jpeg_destroy_compress(&cinfo); |
230 FX_Free(line_buf); | 230 FX_Free(line_buf); |
231 dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer; | 231 dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer; |
232 } | 232 } |
233 | 233 |
234 #ifdef PDF_ENABLE_XFA | 234 #ifdef PDF_ENABLE_XFA |
235 static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, | 235 static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, |
236 CFX_DIBAttribute* pAttribute) { | 236 CFX_DIBAttribute* pAttribute) { |
237 if (pInfo == NULL || pAttribute == NULL) { | |
238 return; | |
239 } | |
240 if (pAttribute) { | 237 if (pAttribute) { |
Tom Sepez
2016/06/02 20:09:48
Agree that pInfo is nonzero in its one caller.
Lei Zhang
2016/06/07 07:33:23
Acknowledged.
| |
241 pAttribute->m_nXDPI = pInfo->X_density; | 238 pAttribute->m_nXDPI = pInfo->X_density; |
242 pAttribute->m_nYDPI = pInfo->Y_density; | 239 pAttribute->m_nYDPI = pInfo->Y_density; |
243 pAttribute->m_wDPIUnit = pInfo->density_unit; | 240 pAttribute->m_wDPIUnit = pInfo->density_unit; |
244 } | 241 } |
245 } | 242 } |
246 #endif // PDF_ENABLE_XFA | 243 #endif // PDF_ENABLE_XFA |
247 | 244 |
248 static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, | 245 static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, |
249 uint32_t src_size, | 246 uint32_t src_size, |
250 int& width, | 247 int& width, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 uint32_t CCodec_JpegModule::GetAvailInput(FXJPEG_Context* ctx, | 644 uint32_t CCodec_JpegModule::GetAvailInput(FXJPEG_Context* ctx, |
648 uint8_t** avail_buf_ptr) { | 645 uint8_t** avail_buf_ptr) { |
649 if (avail_buf_ptr) { | 646 if (avail_buf_ptr) { |
650 *avail_buf_ptr = NULL; | 647 *avail_buf_ptr = NULL; |
651 if (ctx->m_SrcMgr.bytes_in_buffer > 0) { | 648 if (ctx->m_SrcMgr.bytes_in_buffer > 0) { |
652 *avail_buf_ptr = (uint8_t*)ctx->m_SrcMgr.next_input_byte; | 649 *avail_buf_ptr = (uint8_t*)ctx->m_SrcMgr.next_input_byte; |
653 } | 650 } |
654 } | 651 } |
655 return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer; | 652 return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer; |
656 } | 653 } |
OLD | NEW |