- if (get_image_data_size (image) == 0)
- continue;
-
- /* Pixel data */
- if (pixel_data_size > 0)
- {
- if (!write_card32 (cache, image_data_offset + 8))
- return FALSE;
-
- image->image_data->offset = image_data_offset + 8;
- }
- else
- {
- if (!write_card32 (cache, image->image_data->offset))
- return FALSE;
- }
-
- if (meta_data_size > 0)
- {
- if (!write_card32 (cache, image_data_offset + pixel_data_size + 8))
- return FALSE;
- }
- else
- {
- if (!write_card32 (cache, 0))
- return FALSE;
- }
-
- if (pixel_data_size > 0)
- {
- if (!write_pixdata (cache, &image->image_data->pixdata))
- return FALSE;
- }
-
- if (meta_data_size > 0)
- {
- int ofs = image_data_offset + pixel_data_size + 20;
-
- if (image->has_embedded_rect)
- {
- if (!write_card32 (cache, ofs))
- return FALSE;
-
- ofs += 8;
- }
- else
- {
- if (!write_card32 (cache, 0))
- return FALSE;
- }
-
- if (image->n_attach_points > 0)
- {
- if (!write_card32 (cache, ofs))
- return FALSE;
-
- ofs += 4 + 4 * image->n_attach_points;
- }
- else
- {
- if (!write_card32 (cache, 0))
- return FALSE;
- }
-
- if (image->n_display_names > 0)
- {
- if (!write_card32 (cache, ofs))
- return FALSE;
- }
- else
- {
- if (!write_card32 (cache, 0))
- return FALSE;
- }
-
- if (image->has_embedded_rect)
- {
- if (!write_card16 (cache, image->x0) ||
- !write_card16 (cache, image->y0) ||
- !write_card16 (cache, image->x1) ||
- !write_card16 (cache, image->y1))
- return FALSE;
- }
-
- if (image->n_attach_points > 0)
- {
- if (!write_card32 (cache, image->n_attach_points))
- return FALSE;
-
- for (j = 0; j < 2 * image->n_attach_points; j++)
- {
- if (!write_card16 (cache, image->attach_points[j]))
- return FALSE;
- }
- }
-
- if (image->n_display_names > 0)
- {
- if (!write_card32 (cache, image->n_display_names))
- return FALSE;
-
- ofs += 4 + 8 * image->n_display_names;
-
- for (j = 0; j < 2 * image->n_display_names; j++)
- {
- if (!write_card32 (cache, ofs))
- return FALSE;
-
- ofs += ALIGN_VALUE (strlen (image->display_names[j]) + 1, 4);
- }
-
- for (j = 0; j < 2 * image->n_display_names; j++)
- {
- if (!write_string (cache, image->display_names[j]))
- return FALSE;
- }
- }
- }
-
- image_data_offset += pixel_data_size + meta_data_size + 8;
- }
-