swf_fill_style の parse/print 実装
DefineShape の部品のひとつに swf_fill_style がありまして、
この swf_fill_style のデータ構造がちょっと変わってます。
union swf_fill_style { unsigned char f_type; swf_fill_style_solid f_solid; swf_fill_style_gradient f_gradient; swf_fill_style_bitmap f_bitmap; };
union なんですよね。
f_type で、solid, gradient, bitmap のどれかを判別して、続く処理
を切り替えればよいだけなので、分かっていれば対処は簡単です。
swf_fill_style_parse(bitstream_t *bs, swf_fill_style_t *shape_with_style, swf_tag_t * tag) { shape_with_style->type = bitstream_getbyte(bs); switch (shape_with_style->type) { case 0x00: // solid fill swf_fill_style_solid_parse(bs, shape_with_style, tag); break; case 0x10: // linear gradientfill case 0x11: // radial gradientfill <略>
こんな感じで、union の shape_with_style_t の変数をそのまま
swf_fill_style_solid_parse に渡して、渡された方は
shape_with_style_solid_t の型として処理すれば、OK
というわけで、今日も commit