Internal function used to load the jpeg.
| 318 | |
| 319 | // Internal function used to load the jpeg. |
| 320 | ILboolean iLoadJpegInternal() |
| 321 | { |
| 322 | struct jpeg_error_mgr Error; |
| 323 | struct jpeg_decompress_struct JpegInfo; |
| 324 | ILboolean result; |
| 325 | |
| 326 | if (iCurImage == NULL) { |
| 327 | ilSetError(IL_ILLEGAL_OPERATION); |
| 328 | return IL_FALSE; |
| 329 | } |
| 330 | |
| 331 | JpegInfo.err = jpeg_std_error(&Error); // init standard error handlers |
| 332 | Error.error_exit = iJpegErrorExit; // add our exit handler |
| 333 | Error.output_message = OutputMsg; |
| 334 | |
| 335 | if ((result = setjmp(JpegJumpBuffer) == 0) != IL_FALSE) { |
| 336 | jpeg_create_decompress(&JpegInfo); |
| 337 | JpegInfo.do_block_smoothing = IL_TRUE; |
| 338 | JpegInfo.do_fancy_upsampling = IL_TRUE; |
| 339 | |
| 340 | //jpeg_stdio_src(&JpegInfo, iGetFile()); |
| 341 | |
| 342 | devil_jpeg_read_init(&JpegInfo); |
| 343 | jpeg_read_header(&JpegInfo, IL_TRUE); |
| 344 | |
| 345 | result = ilLoadFromJpegStruct(&JpegInfo); |
| 346 | |
| 347 | jpeg_finish_decompress(&JpegInfo); |
| 348 | jpeg_destroy_decompress(&JpegInfo); |
| 349 | |
| 350 | } |
| 351 | else |
| 352 | { |
| 353 | jpeg_destroy_decompress(&JpegInfo); |
| 354 | } |
| 355 | |
| 356 | //return ilFixImage(); // No need to call it again (called first in ilLoadFromJpegStruct). |
| 357 | return result; |
| 358 | } |
| 359 | |
| 360 | |
| 361 |
no test coverage detected