diff src/glyphs-x.c @ 38:1a767b41a199 r19-15b102

Import from CVS: tag r19-15b102
author cvs
date Mon, 13 Aug 2007 08:54:01 +0200
parents c53a95d3c46d
children 8d2a9b52c682
line wrap: on
line diff
--- a/src/glyphs-x.c	Mon Aug 13 08:53:41 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 08:54:01 2007 +0200
@@ -59,9 +59,6 @@
 
 #include <setjmp.h>
 
-/* Set to 1 if you wish to implement this feature */
-# define HAVE_SUBWINDOWS 0
-
 #define LISP_DEVICE_TO_X_SCREEN(dev)					\
   XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev)))
 
@@ -1062,7 +1059,9 @@
 #include "jerror.h"
 
 /* The in-core jpeg code doesn't work, so I'm avoiding it for now.  -sb  */
-#define USE_TEMP_FILES_FOR_JPEG_IMAGES 1
+/* Late-breaking update, we're going to give it a try, I think it's */
+/* fixed now -sb */
+/* #define USE_TEMP_FILES_FOR_JPEG_IMAGES 1 */
 
 static void
 jpeg_validate (Lisp_Object instantiator)
@@ -1183,8 +1182,16 @@
 METHODDEF boolean
 #endif
 our_fill_input_buffer (j_decompress_ptr cinfo) {
-  ERREXIT(cinfo,JERR_INPUT_EOF);
-  return FALSE;
+  /* Insert a fake EOI marker */
+  struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
+  static JOCTET buffer[2];
+
+  buffer[0] = (JOCTET) 0xFF;
+  buffer[1] = (JOCTET) JPEG_EOI;
+
+  src->next_input_byte = buffer;
+  src->bytes_in_buffer = 2;
+  return TRUE;
 }
 
 #if defined(JPEG_LIB_VERSION) && (JPEG_LIB_VERSION >= 61)
@@ -1193,6 +1200,18 @@
 METHODDEF void
 #endif
 our_skip_input_data (j_decompress_ptr cinfo, long num_bytes) {
+  struct jpeg_source_mgr *src = NULL;
+
+  src = (struct jpeg_source_mgr *) cinfo->src;
+
+  if (!src) {
+    return;
+  } else if (num_bytes > src->bytes_in_buffer) {
+    num_bytes = (long)src->bytes_in_buffer;
+  }
+
+  src->bytes_in_buffer -= num_bytes;
+  src->next_input_byte += num_bytes;
 }
 
 #if defined(JPEG_LIB_VERSION) && (JPEG_LIB_VERSION >= 61)