Revert 2008-01-13 change: this is a generated file.
[bpt/emacs.git] / src / image.c
index 0fd0426..04fda4f 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions for image support on window system.
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-                 2001, 2002, 2003, 2004, 2005, 2006, 2007
+                 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
                  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -532,7 +532,7 @@ x_create_bitmap_from_file (f, file)
 /* Free bitmap B.  */
 
 static void
-Free_Bitmap_Record (dpyinfo, bm)
+free_bitmap_record (dpyinfo, bm)
      Display_Info *dpyinfo;
      Bitmap_Record *bm;
 {
@@ -574,7 +574,7 @@ x_destroy_bitmap (f, id)
       if (--bm->refcount == 0)
        {
          BLOCK_INPUT;
-         Free_Bitmap_Record (dpyinfo, bm);
+         free_bitmap_record (dpyinfo, bm);
          UNBLOCK_INPUT;
        }
     }
@@ -591,7 +591,7 @@ x_destroy_all_bitmaps (dpyinfo)
 
   for (i = 0; i < dpyinfo->bitmaps_last; i++, bm++)
     if (bm->refcount > 0)
-      Free_Bitmap_Record (dpyinfo, bm);
+      free_bitmap_record (dpyinfo, bm);
 
   dpyinfo->bitmaps_last = 0;
 }
@@ -733,9 +733,9 @@ Lisp_Object Qxbm;
 /* Keywords.  */
 
 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
-extern Lisp_Object QCdata, QCtype, Qcount;
+extern Lisp_Object QCdata, QCtype;
 extern Lisp_Object Qcenter;
-Lisp_Object QCascent, QCmargin, QCrelief;
+Lisp_Object QCascent, QCmargin, QCrelief, Qcount;
 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
 Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
 
@@ -1710,9 +1710,9 @@ free_image_cache (f)
 /* Clear image cache of frame F.  FORCE_P non-zero means free all
    images.  FORCE_P zero means clear only images that haven't been
    displayed for some time.  Should be called from time to time to
-   reduce the number of loaded images.  If image-eviction-seconds is
-   non-nil, this frees images in the cache which weren't displayed for
-   at least that many seconds.  */
+   reduce the number of loaded images.  If image-cache-eviction-delay
+   is non-nil, this frees images in the cache which weren't displayed
+   for at least that many seconds.  */
 
 void
 clear_image_cache (f, force_p)
@@ -1984,8 +1984,8 @@ lookup_image (f, spec)
          if (INTEGERP (relief))
            {
              img->relief = XINT (relief);
-             img->hmargin += abs (img->relief);
-             img->vmargin += abs (img->relief);
+             img->hmargin += eabs (img->relief);
+             img->vmargin += eabs (img->relief);
            }
 
          if (! img->background_valid)
@@ -2886,7 +2886,7 @@ enum xbm_token
    3. a vector of strings or bool-vectors, one for each line of the
    bitmap.
 
-   4. A string containing an in-memory XBM file.  WIDTH and HEIGHT
+   4. a string containing an in-memory XBM file.  WIDTH and HEIGHT
    may not be specified in this case because they are defined in the
    XBM file.
 
@@ -3128,6 +3128,8 @@ convert_mono_to_color_image (f, img, foreground, background)
   release_frame_dc (f, hdc);
   old_prev = SelectObject (old_img_dc, img->pixmap);
   new_prev = SelectObject (new_img_dc, new_pixmap);
+  /* Windows convention for mono bitmaps is black = background,
+     white = foreground.  */
   SetTextColor (new_img_dc, background);
   SetBkColor (new_img_dc, foreground);
 
@@ -3523,6 +3525,19 @@ xbm_load (f, img)
          else
            bits = XBOOL_VECTOR (data)->data;
 
+#ifdef WINDOWSNT
+          {
+            char *invertedBits;
+            int nbytes, i;
+            /* Windows mono bitmaps are reversed compared with X.  */
+            invertedBits = bits;
+            nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR 
+              * img->height;
+            bits = (char *) alloca(nbytes);
+            for (i = 0; i < nbytes; i++)
+              bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
+          }
+#endif
          /* Create the pixmap.  */
 
          Create_Pixmap_From_Bitmap_Data (f, img, bits,
@@ -4283,7 +4298,7 @@ xpm_scan (s, end, beg, len)
   return XPM_TK_EOF;
 }
 
-/* Functions for color table lookup in XPM data.  A Key is a string
+/* Functions for color table lookup in XPM data.  A key is a string
    specifying the color of each pixel in XPM data.  A value is either
    an integer that specifies a pixel color, Qt that specifies
    transparency, or Qnil for the unspecified color.  If the length of
@@ -5165,7 +5180,7 @@ x_detect_edges (f, img, matrix, color_adjust)
   int x, y, i, sum;
 
   for (i = sum = 0; i < 9; ++i)
-    sum += abs (matrix[i]);
+    sum += eabs (matrix[i]);
 
 #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X))
 
@@ -6777,7 +6792,7 @@ our_common_term_source (cinfo)
    whenever more data is needed.  We read the whole image in one step,
    so this only adds a fake end of input marker at the end.  */
 
-static JOCTET omfib_buffer[2];
+static JOCTET our_memory_buffer[2];
 
 static boolean
 our_memory_fill_input_buffer (cinfo)
@@ -6786,10 +6801,10 @@ our_memory_fill_input_buffer (cinfo)
   /* Insert a fake EOI marker.  */
   struct jpeg_source_mgr *src = cinfo->src;
 
-  omfib_buffer[0] = (JOCTET) 0xFF;
-  omfib_buffer[1] = (JOCTET) JPEG_EOI;
+  our_memory_buffer[0] = (JOCTET) 0xFF;
+  our_memory_buffer[1] = (JOCTET) JPEG_EOI;
 
-  src->next_input_byte = omfib_buffer;
+  src->next_input_byte = our_memory_buffer;
   src->bytes_in_buffer = 2;
   return 1;
 }
@@ -8442,16 +8457,16 @@ svg_load (f, img)
   return success_p;
 }
 
-/* svg_load_image is a helper function for svg_load, which does the actual
- loading given contents and size, apart from frame and image
- structures, passed from svg_load.
+/* svg_load_image is a helper function for svg_load, which does the
  actual loading given contents and size, apart from frame and image
  structures, passed from svg_load.
 
- Uses librsvg to do most of the image processing.
  Uses librsvg to do most of the image processing.
 
Returns non-zero when sucessful.  */
  Returns non-zero when successful.  */
 static int
 svg_load_image (f, img, contents, size)
-    /* Pointer to emacs frame sturcture.  */
+    /* Pointer to emacs frame structure.  */
      struct frame *f;
      /* Pointer to emacs image structure.  */
      struct image *img;
@@ -8561,8 +8576,8 @@ svg_load_image (f, img, contents, size)
 
   /* This loop handles opacity values, since Emacs assumes
      non-transparent images.  Each pixel must be "flattened" by
-     calculating he resulting color, given the transparency of the
-     pixel, and the image background color.   */
+     calculating the resulting color, given the transparency of the
+     pixel, and the image background color.  */
   for (y = 0; y < height; ++y)
     {
       for (x = 0; x < width; ++x)
@@ -9045,7 +9060,7 @@ syms_of_image ()
      defining the supported image types.  */
   DEFVAR_LISP ("image-types", &Vimage_types,
     doc: /* List of potentially supported image types.
-Each element of the list is a symbol for a image type, like 'jpeg or 'png.
+Each element of the list is a symbol for an image type, like 'jpeg or 'png.
 To check whether it is really supported, use `image-type-available-p'.  */);
   Vimage_types = Qnil;
 
@@ -9089,6 +9104,9 @@ non-numeric, there is no explicit limit on the size of images.  */);
   define_image_type (&xbm_type, 1);
   define_image_type (&pbm_type, 1);
 
+  Qcount = intern ("count");
+  staticpro (&Qcount);
+
   QCascent = intern (":ascent");
   staticpro (&QCascent);
   QCmargin = intern (":margin");