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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if(!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) { | 184 if(!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) { |
185 png_error(png_ptr, "Ask Scanline buffer Callback Error"); | 185 png_error(png_ptr, "Ask Scanline buffer Callback Error"); |
186 } | 186 } |
187 if(src_buf != NULL) { | 187 if(src_buf != NULL) { |
188 png_progressive_combine_row(png_ptr, src_buf, new_row); | 188 png_progressive_combine_row(png_ptr, src_buf, new_row); |
189 } | 189 } |
190 pModule->FillScanlineBufCompletedCallback(p->child_ptr, pass, row_num); | 190 pModule->FillScanlineBufCompletedCallback(p->child_ptr, pass, row_num); |
191 } | 191 } |
192 void* CCodec_PngModule::Start(void* pModule) | 192 void* CCodec_PngModule::Start(void* pModule) |
193 { | 193 { |
194 FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(FX_BYTE, sizeof(FXPNG_Context)); | 194 FXPNG_Context* p = (FXPNG_Context*)FX_Alloc(uint8_t, sizeof(FXPNG_Context)); |
195 if(p == NULL) { | 195 if(p == NULL) { |
196 return NULL; | 196 return NULL; |
197 } | 197 } |
198 p->m_AllocFunc = _png_alloc_func; | 198 p->m_AllocFunc = _png_alloc_func; |
199 p->m_FreeFunc = _png_free_func; | 199 p->m_FreeFunc = _png_free_func; |
200 p->png_ptr = NULL; | 200 p->png_ptr = NULL; |
201 p->info_ptr = NULL; | 201 p->info_ptr = NULL; |
202 p->parent_ptr = (void*)this; | 202 p->parent_ptr = (void*)this; |
203 p->child_ptr = pModule; | 203 p->child_ptr = pModule; |
204 p->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)
; | 204 p->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)
; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 FXPNG_Context* p = (FXPNG_Context*)pContext; | 239 FXPNG_Context* p = (FXPNG_Context*)pContext; |
240 if(setjmp(png_jmpbuf(p->png_ptr))) { | 240 if(setjmp(png_jmpbuf(p->png_ptr))) { |
241 if (pAttribute && 0 == FXSYS_strcmp(m_szLastError, "Read Header Callback
Error")) { | 241 if (pAttribute && 0 == FXSYS_strcmp(m_szLastError, "Read Header Callback
Error")) { |
242 _png_load_bmp_attribute(p->png_ptr, p->info_ptr, pAttribute); | 242 _png_load_bmp_attribute(p->png_ptr, p->info_ptr, pAttribute); |
243 } | 243 } |
244 return FALSE; | 244 return FALSE; |
245 } | 245 } |
246 png_process_data(p->png_ptr, p->info_ptr, (FX_LPBYTE)src_buf, src_size); | 246 png_process_data(p->png_ptr, p->info_ptr, (FX_LPBYTE)src_buf, src_size); |
247 return TRUE; | 247 return TRUE; |
248 } | 248 } |
OLD | NEW |