changeset 57278:4cec0243673a

(fringe_bmp): Change to pointer. (max_fringe_bmp): New var. (w32_define_fringe_bitmap): Expand fringe_bmp. (w32_draw_fringe_bitmap): Check max_fringe_bmp. (w32_destroy_fringe_bitmap): Likewise.
author Kim F. Storm <storm@cua.dk>
date Wed, 29 Sep 2004 14:23:21 +0000
parents 85230b6628b3
children c8797551b3a0
files src/w32term.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Wed Sep 29 14:22:25 2004 +0000
+++ b/src/w32term.c	Wed Sep 29 14:23:21 2004 +0000
@@ -62,7 +62,8 @@
 
 /* Fringe bitmaps.  */
 
-static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS];
+static int max_fringe_bmp = 0;
+static HBITMAP *fringe_bmp = 0;
 
 /* Non-nil means Emacs uses toolkit scroll bars.  */
 
@@ -704,7 +705,7 @@
 		     p->bx, p->by, p->nx, p->ny);
     }
 
-  if (p->which)
+  if (p->which && p->which < max_fringe_bmp)
     {
       HBITMAP pixmap = fringe_bmp[p->which];
       HDC compat_hdc;
@@ -767,6 +768,15 @@
      unsigned short *bits;
      int h, wd;
 {
+  if (which >= max_fringe_bmp)
+    {
+      int i = max_fringe_bmp;
+      max_fringe_bmp = which + 20;
+      fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP));
+      while (i < max_fringe_bmp)
+	fringe_bmp[i++] = 0;
+    }
+
   fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits);
 }
 
@@ -774,6 +784,9 @@
 w32_destroy_fringe_bitmap (which)
      int which;
 {
+  if (which >= max_fringe_bmp)
+    return;
+
   if (fringe_bmp[which])
     DeleteObject (fringe_bmp[which]);
   fringe_bmp[which] = 0;