Lines Matching +full:bm +full:- +full:work
2 * Copyright 2006 Richard Wilson <richard.wilson@netsurf-browser.org>
5 * This file is part of NetSurf's libnsbmp, http://www.netsurf-browser.org/
7 * http://www.opensource.org/licenses/mit-license.php
17 * https://msdn.microsoft.com/en-us/library/dd183391(v=vs.85).aspx
85 if (bmp->buffer_size < (BMP_FILE_HEADER_SIZE + BITMAPCOREHEADER)) { in bmp_info_header_parse()
92 if ((bmp->buffer_size - BMP_FILE_HEADER_SIZE) < header_size) { in bmp_info_header_parse()
113 bmp->reversed = true; in bmp_info_header_parse()
114 height = -height; in bmp_info_header_parse()
118 * height of XOR-Bitmap and AND-Bitmap (double the visible height) in bmp_info_header_parse()
122 if (bmp->ico) { in bmp_info_header_parse()
126 bmp->width = width; in bmp_info_header_parse()
127 bmp->height = height / 2; in bmp_info_header_parse()
130 bmp->width = width; in bmp_info_header_parse()
131 bmp->height = height; in bmp_info_header_parse()
135 bmp->bpp = read_uint16(data, 10); in bmp_info_header_parse()
137 * The bpp value should be in the range 1-32, but the only in bmp_info_header_parse()
141 if ((bmp->bpp != 1) && (bmp->bpp != 4) && in bmp_info_header_parse()
142 (bmp->bpp != 8) && in bmp_info_header_parse()
143 (bmp->bpp != 16) && in bmp_info_header_parse()
144 (bmp->bpp != 24) && in bmp_info_header_parse()
145 (bmp->bpp != 32)) in bmp_info_header_parse()
147 if (bmp->bpp < 16) in bmp_info_header_parse()
148 bmp->colours = (1 << bmp->bpp); in bmp_info_header_parse()
190 bmp->reversed = true; in bmp_info_header_parse()
191 if (height <= -INT32_MAX) { in bmp_info_header_parse()
194 height = -height; in bmp_info_header_parse()
199 * height of XOR-Bitmap and AND-Bitmap (double the visible height) in bmp_info_header_parse()
203 if (bmp->ico) { in bmp_info_header_parse()
207 bmp->width = width; in bmp_info_header_parse()
208 bmp->height = height / 2; in bmp_info_header_parse()
211 bmp->width = width; in bmp_info_header_parse()
212 bmp->height = height; in bmp_info_header_parse()
216 bmp->bpp = read_uint16(data, 14); in bmp_info_header_parse()
217 if (bmp->bpp == 0) in bmp_info_header_parse()
218 bmp->bpp = 8; in bmp_info_header_parse()
219 bmp->encoding = read_uint32(data, 16); in bmp_info_header_parse()
221 * The bpp value should be in the range 1-32, but the only in bmp_info_header_parse()
228 switch (bmp->encoding) { in bmp_info_header_parse()
230 if ((bmp->bpp != 1) && (bmp->bpp != 4) && in bmp_info_header_parse()
231 (bmp->bpp != 8) && in bmp_info_header_parse()
232 (bmp->bpp != 16) && in bmp_info_header_parse()
233 (bmp->bpp != 24) && in bmp_info_header_parse()
234 (bmp->bpp != 32)) in bmp_info_header_parse()
238 if (bmp->bpp != 8) in bmp_info_header_parse()
242 if (bmp->bpp != 4) in bmp_info_header_parse()
246 if ((bmp->bpp != 16) && (bmp->bpp != 32)) in bmp_info_header_parse()
256 * align them in our 24-bit color 8-bit alpha format. in bmp_info_header_parse()
258 if (bmp->encoding == BMP_ENCODING_BITFIELDS) { in bmp_info_header_parse()
261 if (bmp->buffer_size < (14 + header_size)) in bmp_info_header_parse()
264 bmp->mask[i] = read_uint32(data, 40 + (i << 2)); in bmp_info_header_parse()
269 bmp->mask[i] = read_uint32(data, 40 + (i << 2)); in bmp_info_header_parse()
272 if (bmp->mask[i] == 0) in bmp_info_header_parse()
274 for (j = 31; j > 0; j--) in bmp_info_header_parse()
275 if (bmp->mask[i] & ((unsigned)1 << j)) { in bmp_info_header_parse()
276 if ((j - 7) > 0) in bmp_info_header_parse()
277 bmp->mask[i] &= (unsigned)0xff << (j - 7); in bmp_info_header_parse()
279 bmp->mask[i] &= 0xff >> (-(j - 7)); in bmp_info_header_parse()
280 bmp->shift[i] = (i << 3) - (j - 7); in bmp_info_header_parse()
285 bmp->colours = read_uint32(data, 32); in bmp_info_header_parse()
286 if (bmp->colours == 0 && bmp->bpp < 16) in bmp_info_header_parse()
287 bmp->colours = (1 << bmp->bpp); in bmp_info_header_parse()
293 if ((!bmp->ico) && (bmp->mask[3] == 0)) { in bmp_info_header_parse()
295 bmp->opaque = true; in bmp_info_header_parse()
299 if (bmp->bpp < 16) { in bmp_info_header_parse()
311 if (bmp->buffer_size < (14 + header_size + ((uint64_t)4 * bmp->colours))) in bmp_info_header_parse()
315 bmp->colour_table = (uint32_t *)malloc(bmp->colours * 4); in bmp_info_header_parse()
316 if (!bmp->colour_table) in bmp_info_header_parse()
318 for (i = 0; i < bmp->colours; i++) { in bmp_info_header_parse()
320 if (bmp->opaque) in bmp_info_header_parse()
323 bmp->colour_table[i] = read_uint32((uint8_t *)&colour,0); in bmp_info_header_parse()
326 /* some bitmaps have a bad offset if there is a pallete, work in bmp_info_header_parse()
331 if ((bmp->bitmap_offset < (uint32_t)(data - bmp->bmp_data)) && in bmp_info_header_parse()
332 ((bmp->buffer_size - (data - bmp->bmp_data)) > 0)) { in bmp_info_header_parse()
333 bmp->bitmap_offset = data - bmp->bmp_data; in bmp_info_header_parse()
339 bmp->bitmap = bmp->bitmap_callbacks.bitmap_create(bmp->width, bmp->height, flags); in bmp_info_header_parse()
340 if (!bmp->bitmap) { in bmp_info_header_parse()
341 if (bmp->colour_table) in bmp_info_header_parse()
342 free(bmp->colour_table); in bmp_info_header_parse()
343 bmp->colour_table = NULL; in bmp_info_header_parse()
349 if (bmp->ico) in bmp_info_header_parse()
350 bmp->bitmap_offset = (uintptr_t)data - (uintptr_t)bmp->bmp_data; in bmp_info_header_parse()
364 /* standard 14-byte BMP file header is: in bmp_file_header_parse()
366 * +0 UINT16 File Type ('BM') in bmp_file_header_parse()
372 if (bmp->buffer_size < BMP_FILE_HEADER_SIZE) in bmp_file_header_parse()
378 bmp->bitmap_offset = read_uint32(data, 10); in bmp_file_header_parse()
381 if (bmp->bitmap_offset >= bmp->buffer_size) { in bmp_file_header_parse()
398 bmp_create(&image->bmp, &ico->bitmap_callbacks); in next_ico_image()
399 image->next = ico->first; in next_ico_image()
400 ico->first = image; in next_ico_image()
418 /* 6-byte ICO file header is: in ico_header_parse()
424 if (ico->buffer_size < ICO_FILE_HEADER_SIZE) in ico_header_parse()
436 if (ico->buffer_size < (uint32_t)(ICO_FILE_HEADER_SIZE + (ICO_DIR_ENTRY_SIZE * count))) in ico_header_parse()
441 * 16-byte ICO directory entry is: in ico_header_parse()
460 image->bmp.width = read_uint8(data, 0); in ico_header_parse()
461 if (image->bmp.width == 0) in ico_header_parse()
462 image->bmp.width = 256; in ico_header_parse()
463 image->bmp.height = read_uint8(data, 1); in ico_header_parse()
464 if (image->bmp.height == 0) in ico_header_parse()
465 image->bmp.height = 256; in ico_header_parse()
466 image->bmp.buffer_size = read_uint32(data, 8); in ico_header_parse()
467 image->bmp.bmp_data = ico->ico_data + read_uint32(data, 12); in ico_header_parse()
468 if (image->bmp.bmp_data + image->bmp.buffer_size > in ico_header_parse()
469 ico->ico_data + ico->buffer_size) in ico_header_parse()
471 image->bmp.ico = true; in ico_header_parse()
475 if (image->bmp.bmp_data - ico->ico_data >= 0 && in ico_header_parse()
476 (uint32_t)(image->bmp.bmp_data - in ico_header_parse()
477 ico->ico_data) >= ico->buffer_size) in ico_header_parse()
481 if (image->bmp.buffer_size - ICO_DIR_ENTRY_SIZE >= in ico_header_parse()
482 ico->buffer_size - (ico->ico_data - data)) in ico_header_parse()
485 result = bmp_info_header_parse(&image->bmp, in ico_header_parse()
486 image->bmp.bmp_data); in ico_header_parse()
491 area = image->bmp.width * image->bmp.height; in ico_header_parse()
493 ico->width = image->bmp.width; in ico_header_parse()
494 ico->height = image->bmp.height; in ico_header_parse()
522 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rgb32()
523 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rgb32()
526 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rgb32()
528 bmp->decoded = true; in bmp_decode_rgb32()
531 if (bmp->limited_trans) { in bmp_decode_rgb32()
534 if (bmp->encoding == BMP_ENCODING_BITFIELDS) in bmp_decode_rgb32()
535 bmp->transparent_index = read_uint32(data, 0); in bmp_decode_rgb32()
537 bmp->transparent_index = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb32()
540 for (y = 0; y < bmp->height; y++) { in bmp_decode_rgb32()
541 if ((data + (4 * bmp->width)) > end) in bmp_decode_rgb32()
543 if (bmp->reversed) in bmp_decode_rgb32()
546 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rgb32()
547 if (bmp->encoding == BMP_ENCODING_BITFIELDS) { in bmp_decode_rgb32()
548 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb32()
551 if (bmp->shift[i] > 0) in bmp_decode_rgb32()
552 … scanline[x] |= ((word & bmp->mask[i]) << bmp->shift[i]); in bmp_decode_rgb32()
554 … scanline[x] |= ((word & bmp->mask[i]) >> (-bmp->shift[i])); in bmp_decode_rgb32()
555 … /* 32-bit BMPs have alpha masks, but sometimes they're not utilized */ in bmp_decode_rgb32()
556 if (bmp->opaque) in bmp_decode_rgb32()
562 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb32()
564 … if ((bmp->limited_trans) && (scanline[x] == bmp->transparent_index)) { in bmp_decode_rgb32()
565 scanline[x] = bmp->trans_colour; in bmp_decode_rgb32()
567 if (bmp->opaque) { in bmp_decode_rgb32()
601 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rgb24()
602 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rgb24()
607 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rgb24()
610 bmp->decoded = true; in bmp_decode_rgb24()
613 if (bmp->limited_trans) { in bmp_decode_rgb24()
618 bmp->transparent_index = data[2] | (data[1] << 8) | (data[0] << 16); in bmp_decode_rgb24()
621 for (y = 0; y < bmp->height; y++) { in bmp_decode_rgb24()
622 if ((data + (3 * bmp->width)) > end) { in bmp_decode_rgb24()
626 if (bmp->reversed) { in bmp_decode_rgb24()
629 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rgb24()
632 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb24()
634 if ((bmp->limited_trans) && (scanline[x] == bmp->transparent_index)) { in bmp_decode_rgb24()
635 scanline[x] = bmp->trans_colour; in bmp_decode_rgb24()
672 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rgb16()
673 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rgb16()
676 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rgb16()
679 bmp->decoded = true; in bmp_decode_rgb16()
682 if (bmp->limited_trans) { in bmp_decode_rgb16()
685 bmp->transparent_index = read_uint16(data, 0); in bmp_decode_rgb16()
688 for (y = 0; y < bmp->height; y++) { in bmp_decode_rgb16()
689 if ((data + (2 * bmp->width)) > end) in bmp_decode_rgb16()
691 if (bmp->reversed) in bmp_decode_rgb16()
694 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rgb16()
695 if (bmp->encoding == BMP_ENCODING_BITFIELDS) { in bmp_decode_rgb16()
696 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb16()
698 if ((bmp->limited_trans) && (word == bmp->transparent_index)) in bmp_decode_rgb16()
699 scanline[x] = bmp->trans_colour; in bmp_decode_rgb16()
703 if (bmp->shift[i] > 0) in bmp_decode_rgb16()
704 … scanline[x] |= ((word & bmp->mask[i]) << bmp->shift[i]); in bmp_decode_rgb16()
706 … scanline[x] |= ((word & bmp->mask[i]) >> (-bmp->shift[i])); in bmp_decode_rgb16()
707 if (bmp->opaque) in bmp_decode_rgb16()
714 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb16()
716 if ((bmp->limited_trans) && (word == bmp->transparent_index)) in bmp_decode_rgb16()
717 scanline[x] = bmp->trans_colour; in bmp_decode_rgb16()
719 /* 16-bit RGB defaults to RGB555 */ in bmp_decode_rgb16()
724 if (bmp->opaque) in bmp_decode_rgb16()
755 uint8_t ppb = 8 / bmp->bpp; in bmp_decode_rgb()
756 uint8_t bit_mask = (1 << bmp->bpp) - 1; in bmp_decode_rgb()
760 bit_shifts[i] = 8 - ((i + 1) * bmp->bpp); in bmp_decode_rgb()
763 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rgb()
764 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rgb()
767 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rgb()
770 bmp->decoded = true; in bmp_decode_rgb()
773 if (bmp->limited_trans) { in bmp_decode_rgb()
775 if (idx >= bmp->colours) in bmp_decode_rgb()
777 bmp->transparent_index = bmp->colour_table[idx]; in bmp_decode_rgb()
780 for (y = 0; y < bmp->height; y++) { in bmp_decode_rgb()
782 if ((data + ((bmp->width + ppb - 1) / ppb)) > end) in bmp_decode_rgb()
784 if (bmp->reversed) in bmp_decode_rgb()
787 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rgb()
788 for (x = 0; x < bmp->width; x++) { in bmp_decode_rgb()
795 if (idx < bmp->colours) { in bmp_decode_rgb()
797 scanline[x] = bmp->colour_table[idx]; in bmp_decode_rgb()
798 if ((bmp->limited_trans) && in bmp_decode_rgb()
799 (scanline[x] == bmp->transparent_index)) { in bmp_decode_rgb()
800 scanline[x] = bmp->trans_colour; in bmp_decode_rgb()
828 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_mask()
829 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_mask()
832 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_mask()
837 for (y = 0; y < bmp->height; y++) { in bmp_decode_mask()
838 if ((data + (bmp->width >> 3)) > end) in bmp_decode_mask()
840 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_mask()
841 for (x = 0; x < bmp->width; x++) { in bmp_decode_mask()
880 if (bmp->ico) in bmp_decode_rle8()
883 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rle8()
884 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rle8()
887 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rle8()
889 bmp->decoded = true; in bmp_decode_rle8()
899 /* 00 - 00 means end of scanline */ in bmp_decode_rle8()
903 if (y >= bmp->height) in bmp_decode_rle8()
910 /* 00 - 01 means end of RLE data */ in bmp_decode_rle8()
914 /* 00 - 02 - XX - YY means move cursor */ in bmp_decode_rle8()
918 if (x >= bmp->width) in bmp_decode_rle8()
921 if (y >= bmp->height) in bmp_decode_rle8()
926 /* 00 - NN means escape NN pixels */ in bmp_decode_rle8()
927 if (bmp->reversed) { in bmp_decode_rle8()
928 pixels_left = (bmp->height - y) * bmp->width - x; in bmp_decode_rle8()
931 pixels_left = (y + 1) * bmp->width - x; in bmp_decode_rle8()
932 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rle8()
945 if (x >= bmp->width) { in bmp_decode_rle8()
948 if (y >= bmp->height) in bmp_decode_rle8()
950 if (bmp->reversed) { in bmp_decode_rle8()
951 scanline += bmp->width; in bmp_decode_rle8()
953 scanline -= bmp->width; in bmp_decode_rle8()
956 if (idx >= bmp->colours) in bmp_decode_rle8()
958 scanline[x++] = bmp->colour_table[idx]; in bmp_decode_rle8()
970 if (bmp->reversed) { in bmp_decode_rle8()
971 pixels_left = (bmp->height - y) * bmp->width - x; in bmp_decode_rle8()
974 pixels_left = (y + 1) * bmp->width - x; in bmp_decode_rle8()
975 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rle8()
989 if (idx >= bmp->colours) in bmp_decode_rle8()
992 pixel = bmp->colour_table[idx]; in bmp_decode_rle8()
994 if (x >= bmp->width) { in bmp_decode_rle8()
997 if (y >= bmp->height) in bmp_decode_rle8()
999 if (bmp->reversed) { in bmp_decode_rle8()
1000 scanline += bmp->width; in bmp_decode_rle8()
1002 scanline -= bmp->width; in bmp_decode_rle8()
1034 if (bmp->ico) in bmp_decode_rle4()
1037 swidth = sizeof(uint32_t) * bmp->width; in bmp_decode_rle4()
1038 top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap); in bmp_decode_rle4()
1041 bottom = top + (uint64_t)swidth * (bmp->height - 1); in bmp_decode_rle4()
1043 bmp->decoded = true; in bmp_decode_rle4()
1053 /* 00 - 00 means end of scanline */ in bmp_decode_rle4()
1057 if (y >= bmp->height) in bmp_decode_rle4()
1064 /* 00 - 01 means end of RLE data */ in bmp_decode_rle4()
1068 /* 00 - 02 - XX - YY means move cursor */ in bmp_decode_rle4()
1072 if (x >= bmp->width) in bmp_decode_rle4()
1075 if (y >= bmp->height) in bmp_decode_rle4()
1080 /* 00 - NN means escape NN pixels */ in bmp_decode_rle4()
1081 if (bmp->reversed) { in bmp_decode_rle4()
1082 pixels_left = (bmp->height - y) * bmp->width - x; in bmp_decode_rle4()
1085 pixels_left = (y + 1) * bmp->width - x; in bmp_decode_rle4()
1086 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rle4()
1099 if (x >= bmp->width) { in bmp_decode_rle4()
1102 if (y >= bmp->height) in bmp_decode_rle4()
1104 if (bmp->reversed) { in bmp_decode_rle4()
1105 scanline += bmp->width; in bmp_decode_rle4()
1107 scanline -= bmp->width; in bmp_decode_rle4()
1113 if ((pixel >> 4) >= bmp->colours) in bmp_decode_rle4()
1115 scanline[x++] = bmp->colour_table in bmp_decode_rle4()
1118 if ((pixel & 0xf) >= bmp->colours) in bmp_decode_rle4()
1120 scanline[x++] = bmp->colour_table in bmp_decode_rle4()
1133 if (bmp->reversed) { in bmp_decode_rle4()
1134 pixels_left = (bmp->height - y) * bmp->width - x; in bmp_decode_rle4()
1137 pixels_left = (y + 1) * bmp->width - x; in bmp_decode_rle4()
1138 scanline = (void *)(bottom - (y * swidth)); in bmp_decode_rle4()
1153 if ((pixel2 >> 4) >= bmp->colours || in bmp_decode_rle4()
1154 (pixel2 & 0xf) >= bmp->colours) in bmp_decode_rle4()
1156 pixel = bmp->colour_table[pixel2 >> 4]; in bmp_decode_rle4()
1157 pixel2 = bmp->colour_table[pixel2 & 0xf]; in bmp_decode_rle4()
1159 if (x >= bmp->width) { in bmp_decode_rle4()
1162 if (y >= bmp->height) in bmp_decode_rle4()
1164 if (bmp->reversed) { in bmp_decode_rle4()
1165 scanline += bmp->width; in bmp_decode_rle4()
1167 scanline -= bmp->width; in bmp_decode_rle4()
1189 bmp->bitmap_callbacks = *bitmap_callbacks; in bmp_create()
1202 ico->bitmap_callbacks = *bitmap_callbacks; in ico_collection_create()
1214 if (bmp->bitmap) { in bmp_analyse()
1219 bmp->buffer_size = size; in bmp_analyse()
1220 bmp->bmp_data = data; in bmp_analyse()
1234 if (ico->first) in ico_analyse()
1238 ico->buffer_size = size; in ico_analyse()
1239 ico->ico_data = data; in ico_analyse()
1252 data = bmp->bmp_data + bmp->bitmap_offset; in bmp_decode()
1253 bytes = bmp->buffer_size - bmp->bitmap_offset; in bmp_decode()
1255 switch (bmp->encoding) { in bmp_decode()
1257 switch (bmp->bpp) { in bmp_decode()
1285 switch (bmp->bpp) { in bmp_decode()
1302 if ((result == BMP_OK) && (bmp->ico) && (bmp->bpp != 32)) { in bmp_decode()
1303 bytes = (uintptr_t)bmp->bmp_data + bmp->buffer_size - (uintptr_t)data; in bmp_decode()
1313 bmp->limited_trans = true; in bmp_decode_trans()
1314 bmp->trans_colour = colour; in bmp_decode_trans()
1327 width = ico->width; in ico_find()
1329 height = ico->height; in ico_find()
1330 for (image = ico->first; image; image = image->next) { in ico_find()
1331 if ((image->bmp.width == width) && (image->bmp.height == height)) in ico_find()
1332 return &image->bmp; in ico_find()
1333 x = image->bmp.width - width; in ico_find()
1334 y = image->bmp.height - height; in ico_find()
1338 bmp = &image->bmp; in ico_find()
1348 if (bmp->bitmap) in bmp_finalise()
1349 bmp->bitmap_callbacks.bitmap_destroy(bmp->bitmap); in bmp_finalise()
1350 bmp->bitmap = NULL; in bmp_finalise()
1351 if (bmp->colour_table) in bmp_finalise()
1352 free(bmp->colour_table); in bmp_finalise()
1353 bmp->colour_table = NULL; in bmp_finalise()
1362 for (image = ico->first; image; image = image->next) in ico_finalise()
1363 bmp_finalise(&image->bmp); in ico_finalise()
1364 while (ico->first) { in ico_finalise()
1365 image = ico->first; in ico_finalise()
1366 ico->first = image->next; in ico_finalise()