comparison src/w32term.c @ 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 e6e0caa7ec87
children 38e45bf0128a f70dc61a797f 6c1af301b455
comparison
equal deleted inserted replaced
57277:85230b6628b3 57278:4cec0243673a
60 #define abs(x) ((x) < 0 ? -(x) : (x)) 60 #define abs(x) ((x) < 0 ? -(x) : (x))
61 61
62 62
63 /* Fringe bitmaps. */ 63 /* Fringe bitmaps. */
64 64
65 static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS]; 65 static int max_fringe_bmp = 0;
66 static HBITMAP *fringe_bmp = 0;
66 67
67 /* Non-nil means Emacs uses toolkit scroll bars. */ 68 /* Non-nil means Emacs uses toolkit scroll bars. */
68 69
69 Lisp_Object Vx_toolkit_scroll_bars; 70 Lisp_Object Vx_toolkit_scroll_bars;
70 71
702 { 703 {
703 w32_fill_area (f, hdc, face->background, 704 w32_fill_area (f, hdc, face->background,
704 p->bx, p->by, p->nx, p->ny); 705 p->bx, p->by, p->nx, p->ny);
705 } 706 }
706 707
707 if (p->which) 708 if (p->which && p->which < max_fringe_bmp)
708 { 709 {
709 HBITMAP pixmap = fringe_bmp[p->which]; 710 HBITMAP pixmap = fringe_bmp[p->which];
710 HDC compat_hdc; 711 HDC compat_hdc;
711 HANDLE horig_obj; 712 HANDLE horig_obj;
712 713
765 w32_define_fringe_bitmap (which, bits, h, wd) 766 w32_define_fringe_bitmap (which, bits, h, wd)
766 int which; 767 int which;
767 unsigned short *bits; 768 unsigned short *bits;
768 int h, wd; 769 int h, wd;
769 { 770 {
771 if (which >= max_fringe_bmp)
772 {
773 int i = max_fringe_bmp;
774 max_fringe_bmp = which + 20;
775 fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP));
776 while (i < max_fringe_bmp)
777 fringe_bmp[i++] = 0;
778 }
779
770 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits); 780 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits);
771 } 781 }
772 782
773 static void 783 static void
774 w32_destroy_fringe_bitmap (which) 784 w32_destroy_fringe_bitmap (which)
775 int which; 785 int which;
776 { 786 {
787 if (which >= max_fringe_bmp)
788 return;
789
777 if (fringe_bmp[which]) 790 if (fringe_bmp[which])
778 DeleteObject (fringe_bmp[which]); 791 DeleteObject (fringe_bmp[which]);
779 fringe_bmp[which] = 0; 792 fringe_bmp[which] = 0;
780 } 793 }
781 794