Mercurial > hg > xemacs-beta
comparison src/glyphs-msw.c @ 1726:a8d8f419b459
[xemacs-hg @ 2003-09-30 15:26:34 by james]
Add type information to xfree to avoid alias creation.
author | james |
---|---|
date | Tue, 30 Sep 2003 15:27:01 +0000 |
parents | b531bf8658e9 |
children | 543769b89fed |
comparison
equal
deleted
inserted
replaced
1725:7ff8f4d70aec | 1726:a8d8f419b459 |
---|---|
200 *bmp_data = xnew_array_and_zero (UChar_Binary, bpline * height); | 200 *bmp_data = xnew_array_and_zero (UChar_Binary, bpline * height); |
201 *bit_count = bpline * height; | 201 *bit_count = bpline * height; |
202 | 202 |
203 if (!bmp_data) | 203 if (!bmp_data) |
204 { | 204 { |
205 xfree (bmp_info); | 205 xfree (bmp_info, BITMAPINFO *); |
206 return NULL; | 206 return NULL; |
207 } | 207 } |
208 | 208 |
209 ip = pic; | 209 ip = pic; |
210 for (i = height-1; i >= 0; i--) { | 210 for (i = height-1; i >= 0; i--) { |
231 ncolors = qtable->num_active_colors; | 231 ncolors = qtable->num_active_colors; |
232 bmp_info = (BITMAPINFO *)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) + | 232 bmp_info = (BITMAPINFO *)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) + |
233 sizeof(RGBQUAD) * ncolors); | 233 sizeof(RGBQUAD) * ncolors); |
234 if (!bmp_info) | 234 if (!bmp_info) |
235 { | 235 { |
236 xfree (qtable); | 236 xfree (qtable, quant_table *); |
237 return NULL; | 237 return NULL; |
238 } | 238 } |
239 | 239 |
240 colortbl = (RGBQUAD *) (((UChar_Binary *) bmp_info) + | 240 colortbl = (RGBQUAD *) (((UChar_Binary *) bmp_info) + |
241 sizeof (BITMAPINFOHEADER)); | 241 sizeof (BITMAPINFOHEADER)); |
249 *bmp_data = (UChar_Binary *) xmalloc_and_zero (bpline * height); | 249 *bmp_data = (UChar_Binary *) xmalloc_and_zero (bpline * height); |
250 *bit_count = bpline * height; | 250 *bit_count = bpline * height; |
251 | 251 |
252 if (!*bmp_data) | 252 if (!*bmp_data) |
253 { | 253 { |
254 xfree (qtable); | 254 xfree (qtable, quant_table *); |
255 xfree (bmp_info); | 255 xfree (bmp_info, BITMAPINFO *); |
256 return NULL; | 256 return NULL; |
257 } | 257 } |
258 | 258 |
259 /* build up an RGBQUAD colortable */ | 259 /* build up an RGBQUAD colortable */ |
260 for (i = 0; i < qtable->num_active_colors; i++) | 260 for (i = 0; i < qtable->num_active_colors; i++) |
277 gr = *ip++; | 277 gr = *ip++; |
278 bl = *ip++; | 278 bl = *ip++; |
279 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl); | 279 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl); |
280 } | 280 } |
281 } | 281 } |
282 xfree (qtable); | 282 xfree (qtable, quant_table *); |
283 } | 283 } |
284 /* fix up the standard stuff */ | 284 /* fix up the standard stuff */ |
285 bmp_info->bmiHeader.biWidth = width; | 285 bmp_info->bmiHeader.biWidth = width; |
286 bmp_info->bmiHeader.biHeight = height; | 286 bmp_info->bmiHeader.biHeight = height; |
287 bmp_info->bmiHeader.biPlanes = 1; | 287 bmp_info->bmiHeader.biPlanes = 1; |
470 0, 0, 0); | 470 0, 0, 0); |
471 else | 471 else |
472 image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice, | 472 image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice, |
473 instantiator); | 473 instantiator); |
474 | 474 |
475 xfree (bmp_info); | 475 xfree (bmp_info, BITMAPINFO *); |
476 xfree (bmp_data); | 476 xfree (bmp_data, UChar_Binary *); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 inline static void | 480 inline static void |
481 set_mono_pixel (UChar_Binary *bits, | 481 set_mono_pixel (UChar_Binary *bits, |
536 bmp_info, | 536 bmp_info, |
537 DIB_RGB_COLORS, | 537 DIB_RGB_COLORS, |
538 (void **)&and_bits, | 538 (void **)&and_bits, |
539 0,0))) | 539 0,0))) |
540 { | 540 { |
541 xfree (bmp_info); | 541 xfree (bmp_info, BITMAPINFO *); |
542 return; | 542 return; |
543 } | 543 } |
544 | 544 |
545 old = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (image)); | 545 old = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (image)); |
546 /* build up an in-memory set of bits to mess with */ | 546 /* build up an in-memory set of bits to mess with */ |
563 height, | 563 height, |
564 dibits, | 564 dibits, |
565 bmp_info, | 565 bmp_info, |
566 DIB_RGB_COLORS) <= 0) | 566 DIB_RGB_COLORS) <= 0) |
567 { | 567 { |
568 xfree (bmp_info); | 568 xfree (bmp_info, BITMAPINFO *); |
569 return; | 569 return; |
570 } | 570 } |
571 | 571 |
572 /* now set the colored bits in the mask and transparent ones to | 572 /* now set the colored bits in the mask and transparent ones to |
573 black in the original */ | 573 black in the original */ |
595 height, | 595 height, |
596 dibits, | 596 dibits, |
597 bmp_info, | 597 bmp_info, |
598 DIB_RGB_COLORS); | 598 DIB_RGB_COLORS); |
599 | 599 |
600 xfree (bmp_info); | 600 xfree (bmp_info, BITMAPINFO *); |
601 xfree (dibits); | 601 xfree (dibits, UChar_Binary *); |
602 | 602 |
603 SelectObject(hcdc, old); | 603 SelectObject(hcdc, old); |
604 | 604 |
605 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask; | 605 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask; |
606 } | 606 } |
847 | 847 |
848 /* build a color table to speed things up */ | 848 /* build a color table to speed things up */ |
849 colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors); | 849 colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors); |
850 if (!colortbl) | 850 if (!colortbl) |
851 { | 851 { |
852 xfree (*data); | 852 xfree (*data, UChar_Binary *); |
853 XpmFreeXpmImage (&xpmimage); | 853 XpmFreeXpmImage (&xpmimage); |
854 XpmFreeXpmInfo (&xpminfo); | 854 XpmFreeXpmInfo (&xpminfo); |
855 return 0; | 855 return 0; |
856 } | 856 } |
857 | 857 |
903 xpmimage.colorTable[i].c_color); | 903 xpmimage.colorTable[i].c_color); |
904 goto label_found_color; | 904 goto label_found_color; |
905 } | 905 } |
906 | 906 |
907 label_no_color: | 907 label_no_color: |
908 xfree (*data); | 908 xfree (*data, UChar_Binary *); |
909 xfree (colortbl); | 909 xfree (colortbl, COLORREF *); |
910 XpmFreeXpmImage (&xpmimage); | 910 XpmFreeXpmImage (&xpmimage); |
911 XpmFreeXpmInfo (&xpminfo); | 911 XpmFreeXpmInfo (&xpminfo); |
912 return 0; | 912 return 0; |
913 | 913 |
914 label_found_color:; | 914 label_found_color:; |
930 *x_hot = xpminfo.x_hotspot; | 930 *x_hot = xpminfo.x_hotspot; |
931 *y_hot = xpminfo.y_hotspot; | 931 *y_hot = xpminfo.y_hotspot; |
932 | 932 |
933 XpmFreeXpmImage (&xpmimage); | 933 XpmFreeXpmImage (&xpmimage); |
934 XpmFreeXpmInfo (&xpminfo); | 934 XpmFreeXpmInfo (&xpminfo); |
935 xfree (colortbl); | 935 xfree (colortbl, COLORREF *); |
936 return TRUE; | 936 return TRUE; |
937 } | 937 } |
938 | 938 |
939 static void | 939 static void |
940 mswindows_xpm_instantiate (Lisp_Object image_instance, | 940 mswindows_xpm_instantiate (Lisp_Object image_instance, |
980 | 980 |
981 if (color_symbols) | 981 if (color_symbols) |
982 { | 982 { |
983 while (nsymbols--) | 983 while (nsymbols--) |
984 { | 984 { |
985 xfree (color_symbols[nsymbols].name); | 985 xfree (color_symbols[nsymbols].name, Ibyte *); |
986 } | 986 } |
987 xfree(color_symbols); | 987 xfree(color_symbols, struct color_symbol *); |
988 } | 988 } |
989 | 989 |
990 /* build a bitmap from the eimage */ | 990 /* build a bitmap from the eimage */ |
991 if (!(bmp_info = convert_EImage_to_DIBitmap (device, width, height, eimage, | 991 if (!(bmp_info = convert_EImage_to_DIBitmap (device, width, height, eimage, |
992 &bmp_bits, &bmp_data))) | 992 &bmp_bits, &bmp_data))) |
993 { | 993 { |
994 signal_image_error ("XPM to EImage conversion failed", | 994 signal_image_error ("XPM to EImage conversion failed", |
995 image_instance); | 995 image_instance); |
996 } | 996 } |
997 xfree (eimage); | 997 xfree (eimage, UChar_Binary *); |
998 | 998 |
999 /* Now create the pixmap and set up the image instance */ | 999 /* Now create the pixmap and set up the image instance */ |
1000 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask, | 1000 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask, |
1001 bmp_data, bmp_bits, 1, instantiator, | 1001 bmp_data, bmp_bits, 1, instantiator, |
1002 x_hot, y_hot, transp); | 1002 x_hot, y_hot, transp); |
1003 | 1003 |
1004 xfree (bmp_info); | 1004 xfree (bmp_info, BITMAPINFO *); |
1005 xfree (bmp_data); | 1005 xfree (bmp_data, UChar_Binary *); |
1006 } | 1006 } |
1007 #endif /* HAVE_XPM */ | 1007 #endif /* HAVE_XPM */ |
1008 | 1008 |
1009 /********************************************************************** | 1009 /********************************************************************** |
1010 * BMP * | 1010 * BMP * |
1351 | 1351 |
1352 new_data = (UChar_Binary *) xmalloc_and_zero (height * new_width); | 1352 new_data = (UChar_Binary *) xmalloc_and_zero (height * new_width); |
1353 | 1353 |
1354 if (!new_data) | 1354 if (!new_data) |
1355 { | 1355 { |
1356 xfree (bmp_info); | 1356 xfree (bmp_info, BITMAPINFO *); |
1357 return NULL; | 1357 return NULL; |
1358 } | 1358 } |
1359 | 1359 |
1360 for (i = 0; i < height; i++) | 1360 for (i = 0; i < height; i++) |
1361 { | 1361 { |
1402 bmp_info, | 1402 bmp_info, |
1403 DIB_RGB_COLORS, | 1403 DIB_RGB_COLORS, |
1404 &bmp_buf, | 1404 &bmp_buf, |
1405 0,0); | 1405 0,0); |
1406 | 1406 |
1407 xfree (bmp_info); | 1407 xfree (bmp_info, BITMAPINFO *); |
1408 | 1408 |
1409 if (!bitmap || !bmp_buf) | 1409 if (!bitmap || !bmp_buf) |
1410 { | 1410 { |
1411 xfree (new_data); | 1411 xfree (new_data, UChar_Binary *); |
1412 return NULL; | 1412 return NULL; |
1413 } | 1413 } |
1414 | 1414 |
1415 /* copy in the actual bitmap */ | 1415 /* copy in the actual bitmap */ |
1416 memcpy (bmp_buf, new_data, height * new_width); | 1416 memcpy (bmp_buf, new_data, height * new_width); |
1417 xfree (new_data); | 1417 xfree (new_data, UChar_Binary *); |
1418 | 1418 |
1419 return bitmap; | 1419 return bitmap; |
1420 } | 1420 } |
1421 | 1421 |
1422 /* Given inline data for a mono pixmap, initialize the given | 1422 /* Given inline data for a mono pixmap, initialize the given |
1774 { | 1774 { |
1775 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i)) | 1775 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i)) |
1776 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i)); | 1776 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i)); |
1777 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i) = 0; | 1777 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i) = 0; |
1778 } | 1778 } |
1779 xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p)); | 1779 xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p), HBITMAP *); |
1780 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p) = 0; | 1780 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p) = 0; |
1781 } | 1781 } |
1782 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) | 1782 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) |
1783 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (p)); | 1783 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (p)); |
1784 IMAGE_INSTANCE_MSWINDOWS_MASK (p) = 0; | 1784 IMAGE_INSTANCE_MSWINDOWS_MASK (p) = 0; |
1788 } | 1788 } |
1789 } | 1789 } |
1790 | 1790 |
1791 if (p->data) | 1791 if (p->data) |
1792 { | 1792 { |
1793 xfree (p->data); | 1793 xfree (p->data, void *); |
1794 p->data = 0; | 1794 p->data = 0; |
1795 } | 1795 } |
1796 } | 1796 } |
1797 | 1797 |
1798 /************************************************************************/ | 1798 /************************************************************************/ |