Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jpeg.cpp

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1; 189 int nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1;
190 int pitch = pSource->GetPitch(); 190 int pitch = pSource->GetPitch();
191 int width = pSource->GetWidth(); 191 int width = pSource->GetWidth();
192 int height = pSource->GetHeight(); 192 int height = pSource->GetHeight();
193 FX_DWORD dest_buf_length = width * height * nComponents + 1024 + (icc_length ? (icc_length + 255 * 18) : 0); 193 FX_DWORD dest_buf_length = width * height * nComponents + 1024 + (icc_length ? (icc_length + 255 * 18) : 0);
194 dest_buf = FX_Alloc(FX_BYTE, dest_buf_length); 194 dest_buf = FX_Alloc(FX_BYTE, dest_buf_length);
195 while (dest_buf == NULL) { 195 while (dest_buf == NULL) {
196 dest_buf_length >>= 1; 196 dest_buf_length >>= 1;
197 dest_buf = FX_Alloc(FX_BYTE, dest_buf_length); 197 dest_buf = FX_Alloc(FX_BYTE, dest_buf_length);
198 } 198 }
199 FXSYS_memset32(dest_buf, 0, dest_buf_length);
200 struct jpeg_destination_mgr dest; 199 struct jpeg_destination_mgr dest;
201 dest.init_destination = _dest_do_nothing; 200 dest.init_destination = _dest_do_nothing;
202 dest.term_destination = _dest_do_nothing; 201 dest.term_destination = _dest_do_nothing;
203 dest.empty_output_buffer = _dest_empty; 202 dest.empty_output_buffer = _dest_empty;
204 dest.next_output_byte = dest_buf; 203 dest.next_output_byte = dest_buf;
205 dest.free_in_buffer = dest_buf_length; 204 dest.free_in_buffer = dest_buf_length;
206 cinfo.dest = &dest; 205 cinfo.dest = &dest;
207 cinfo.image_width = width; 206 cinfo.image_width = width;
208 cinfo.image_height = height; 207 cinfo.image_height = height;
209 cinfo.input_components = nComponents; 208 cinfo.input_components = nComponents;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); 726 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr);
728 } 727 }
729 if(avail_buf_ptr != NULL) { 728 if(avail_buf_ptr != NULL) {
730 *avail_buf_ptr = NULL; 729 *avail_buf_ptr = NULL;
731 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { 730 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) {
732 *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.ne xt_input_byte; 731 *avail_buf_ptr = (FX_LPBYTE)((FXJPEG_Context*)pContext)->m_SrcMgr.ne xt_input_byte;
733 } 732 }
734 } 733 }
735 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; 734 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
736 } 735 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_flate.cpp ('k') | core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/dwt.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698