Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.3 KiB

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // Required Include files
  3. ////////////////////////////////////////////////////////////////////////////////
  4. // Workaround for redefinition of INT32
  5. #define XMD_H 1
  6. #include "jinclude.h"
  7. #include "jpeglib.h"
  8. #include "jerror.h"
  9. #ifdef WIN32
  10. #include <windows.h>
  11. #endif
  12. GLOBAL void jpeg_dump_decompress(j_decompress_ptr cinfo);
  13. METHODDEF void
  14. init_source (j_decompress_ptr cinfo)
  15. {
  16. return;
  17. }
  18. METHODDEF boolean
  19. fill_input_buffer (j_decompress_ptr cinfo)
  20. {
  21. #ifdef WIN32
  22. #ifdef DEBUG
  23. ::OutputDebugString("JPEGLIB:.fill_input_buffer\n");
  24. #endif
  25. jpeg_dump_decompress(cinfo);
  26. #endif
  27. // We assume that the compressed image is entirely in memory.
  28. // If JPEG requests more data, then there must be an error.
  29. ERREXIT(cinfo, JERR_INPUT_EMPTY);
  30. return TRUE;
  31. }
  32. METHODDEF void
  33. skip_input_data (j_decompress_ptr cinfo, long num_bytes)
  34. {
  35. cinfo->src->next_input_byte += (size_t) num_bytes;
  36. cinfo->src->bytes_in_buffer -= (size_t) num_bytes;
  37. }
  38. METHODDEF void
  39. term_source (j_decompress_ptr cinfo)
  40. {
  41. return;
  42. }
  43. GLOBAL void
  44. jpeg_buf_src (j_decompress_ptr cinfo, unsigned char *buf, long buf_len)
  45. {
  46. if (cinfo->src == NULL) { /* first time for this JPEG object? */
  47. cinfo->src = (struct jpeg_source_mgr *)
  48. (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
  49. SIZEOF(struct jpeg_source_mgr));
  50. }
  51. cinfo->src->init_source = init_source;
  52. cinfo->src->fill_input_buffer = fill_input_buffer;
  53. cinfo->src->skip_input_data = skip_input_data;
  54. cinfo->src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  55. cinfo->src->term_source = term_source;
  56. cinfo->src->bytes_in_buffer = buf_len;
  57. cinfo->src->next_input_byte = buf;
  58. #ifdef WIN32
  59. #ifdef DEBUG
  60. ::OutputDebugString("JPEGLIB:.jpeg_buf_src constructor\n");
  61. #endif
  62. jpeg_dump_decompress(cinfo);
  63. #endif
  64. }
  65. GLOBAL void jpeg_dump_decompress(j_decompress_ptr cinfo)
  66. {
  67. #ifdef WIN32
  68. #ifdef DEBUG
  69. char buf[500];
  70. ::OutputDebugString("JPEGLIB:dumping decompress structure.\n");
  71. ::wsprintf(buf,
  72. "JPEGLIB: buf=0x%X len=%d \n",
  73. cinfo->src->next_input_byte,
  74. cinfo->src->bytes_in_buffer);
  75. ::OutputDebugString(buf);
  76. #endif
  77. #endif
  78. }