]> code.delx.au - gnu-emacs/blobdiff - src/fringe.c
Merge from origin/emacs-25
[gnu-emacs] / src / fringe.c
index c7262d1933627359ef24269f6ed452de367cb5bb..597c666d3bc3e97594cad4cea521a67f8a4993de 100644 (file)
@@ -1,5 +1,5 @@
 /* Fringe handling (split from xdisp.c).
-   Copyright (C) 1985-1988, 1993-1995, 1997-2015 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1997-2016 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "window.h"
 #include "dispextern.h"
-#include "character.h"
 #include "buffer.h"
 #include "blockinput.h"
 #include "termhooks.h"
@@ -587,7 +586,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
   if (face_id == DEFAULT_FACE_ID)
     {
       Lisp_Object face = fringe_faces[which];
-      face_id = NILP (face) ? lookup_named_face (f, Qfringe, 0)
+      face_id = NILP (face) ? lookup_named_face (f, Qfringe, false)
        : lookup_derived_face (f, face, FRINGE_FACE_ID, 0);
       if (face_id < 0)
        face_id = FRINGE_FACE_ID;
@@ -1405,6 +1404,21 @@ init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
       unsigned short *bits = fb->bits;
       int j;
 
+#ifdef USE_CAIRO
+      for (j = 0; j < fb->height; j++)
+       {
+         unsigned short b = *bits;
+#ifdef WORDS_BIGENDIAN
+         *bits++ = (b << (16 - fb->width));
+#else
+         b = (unsigned short)((swap_nibble[b & 0xf] << 12)
+                              | (swap_nibble[(b>>4) & 0xf] << 8)
+                              | (swap_nibble[(b>>8) & 0xf] << 4)
+                              | (swap_nibble[(b>>12) & 0xf]));
+         *bits++ = (b >> (16 - fb->width));
+#endif
+       }
+#else  /* not USE_CAIRO */
       if (fb->width <= 8)
        {
          unsigned char *cbits = (unsigned char *)fb->bits;
@@ -1433,6 +1447,7 @@ init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
              *bits++ = b;
            }
        }
+#endif /* not USE_CAIRO */
 #endif /* HAVE_X_WINDOWS */
 
     }
@@ -1723,21 +1738,22 @@ init_fringe_once (void)
 void
 init_fringe (void)
 {
-  int i;
-
   max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
 
   fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
-  fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces);
 
-  for (i = 0; i < max_fringe_bitmaps; i++)
-    fringe_faces[i] = Qnil;
+  verify (NIL_IS_ZERO);
+  fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces);
 }
 
-#ifdef HAVE_NTGUI
+#if defined (HAVE_NTGUI) || defined (USE_CAIRO)
 
 void
+#ifdef HAVE_NTGUI
 w32_init_fringe (struct redisplay_interface *rif)
+#else
+x_cr_init_fringe (struct redisplay_interface *rif)
+#endif
 {
   int bt;
 
@@ -1750,7 +1766,9 @@ w32_init_fringe (struct redisplay_interface *rif)
       rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
     }
 }
+#endif
 
+#ifdef HAVE_NTGUI
 void
 w32_reset_fringes (void)
 {