- bytestream_put_be16(&pseg_len, q - pseg_len - 2);
- }
- buf_size -= h->num_rects * 22;
+ *q++ = 0x0f; /* sync_byte */
+ *q++ = 0x11; /* segment_type */
+ bytestream_put_be16(&q, page_id);
+ pseg_len = q;
+ q += 2; /* segment length */
+ *q++ = region_id;
+ *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */
+ bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */
+ bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */
+ *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
+ *q++ = region_id; /* clut_id == region_id */
+ *q++ = 0; /* 8 bit fill colors */
+ *q++ = 0x03; /* 4 bit and 2 bit fill colors */
+
+ bytestream_put_be16(&q, region_id); /* object_id == region_id */
+ *q++ = (0 << 6) | (0 << 4);
+ *q++ = 0;
+ *q++ = 0xf0;
+ *q++ = 0;
+
+ bytestream_put_be16(&pseg_len, q - pseg_len - 2);
+ }
+ buf_size -= h->num_rects * 22;