svnno****@sourc*****
svnno****@sourc*****
2011年 3月 30日 (水) 16:07:32 JST
Revision: 488 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=488 Author: yoya Date: 2011-03-30 16:07:32 +0900 (Wed, 30 Mar 2011) Log Message: ----------- - spline 曲線の差分の計算の誤りを修正 - 冗長なコードを少し整理 Modified Paths: -------------- trunk/src/swf_shape_record_edge.c -------------- next part -------------- Modified: trunk/src/swf_shape_record_edge.c =================================================================== --- trunk/src/swf_shape_record_edge.c 2011-03-29 13:32:31 UTC (rev 487) +++ trunk/src/swf_shape_record_edge.c 2011-03-30 07:07:32 UTC (rev 488) @@ -27,10 +27,14 @@ anchor_delta_x = bitstream_getbits_signed(bs, shape_coord_real_size); anchor_delta_y = bitstream_getbits_signed(bs, shape_coord_real_size); - shape_record_edge->shape_control_x = control_delta_x + swf_tag_shape->_current_x; - shape_record_edge->shape_control_y = control_delta_y + swf_tag_shape->_current_y; - shape_record_edge->shape_anchor_x = anchor_delta_x + swf_tag_shape->_current_x; - shape_record_edge->shape_anchor_y = anchor_delta_y + swf_tag_shape->_current_y; + swf_tag_shape->_current_x += control_delta_x; + swf_tag_shape->_current_y += control_delta_y; + shape_record_edge->shape_control_x = swf_tag_shape->_current_x; + shape_record_edge->shape_control_y = swf_tag_shape->_current_y; + swf_tag_shape->_current_x += anchor_delta_x; + swf_tag_shape->_current_y += anchor_delta_y; + shape_record_edge->shape_anchor_x = swf_tag_shape->_current_x; + shape_record_edge->shape_anchor_y = swf_tag_shape->_current_y; } else { shape_record_edge->shape_line_has_x_and_y = bitstream_getbit(bs); if (shape_record_edge->shape_line_has_x_and_y == 1) { @@ -39,8 +43,6 @@ delta_y = bitstream_getbits_signed(bs, shape_coord_real_size); swf_tag_shape->_current_x += delta_x; swf_tag_shape->_current_y += delta_y; - shape_record_edge->shape_x = swf_tag_shape->_current_x; - shape_record_edge->shape_y = swf_tag_shape->_current_y; } else { shape_record_edge->shape_line_has_x_or_y = bitstream_getbit(bs); if (shape_record_edge->shape_line_has_x_or_y == 0) { @@ -52,9 +54,9 @@ delta_y = bitstream_getbits_signed(bs, shape_coord_real_size); swf_tag_shape->_current_y += delta_y; } - shape_record_edge->shape_x = swf_tag_shape->_current_x; - shape_record_edge->shape_y = swf_tag_shape->_current_y; } + shape_record_edge->shape_x = swf_tag_shape->_current_x; + shape_record_edge->shape_y = swf_tag_shape->_current_y; } return 0; } @@ -75,23 +77,24 @@ shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; size = bitstream_need_bits_signed(shape_record_edge->shape_control_y - swf_tag_shape->_current_y); shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; - size = bitstream_need_bits_signed(shape_record_edge->shape_anchor_x - swf_tag_shape->_current_x); + size = bitstream_need_bits_signed(shape_record_edge->shape_anchor_x - shape_record_edge->shape_control_x); shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; - size = bitstream_need_bits_signed(shape_record_edge->shape_anchor_y - swf_tag_shape->_current_y); + size = bitstream_need_bits_signed(shape_record_edge->shape_anchor_y - shape_record_edge->shape_control_y); shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; + } else { + size = bitstream_need_bits_signed(shape_record_edge->shape_x - swf_tag_shape->_current_x); + shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; + size = bitstream_need_bits_signed(shape_record_edge->shape_y - swf_tag_shape->_current_y); + shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; } - size = bitstream_need_bits_signed(shape_record_edge->shape_x - swf_tag_shape->_current_x); - shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; - size = bitstream_need_bits_signed(shape_record_edge->shape_y - swf_tag_shape->_current_y); - shape_coord_real_size = (shape_coord_real_size>size)?shape_coord_real_size:size; - shape_record_edge->shape_coord_size = shape_coord_real_size - 2; + shape_record_edge->shape_coord_size = shape_coord_real_size - 2; bitstream_putbits(bs, shape_record_edge->shape_coord_size, 4); if (shape_record_edge->shape_edge_type == 0) { signed control_delta_x = shape_record_edge->shape_control_x - swf_tag_shape->_current_x; signed control_delta_y = shape_record_edge->shape_control_y - swf_tag_shape->_current_y; - signed anchor_delta_x = shape_record_edge->shape_anchor_x - swf_tag_shape->_current_x; - signed anchor_delta_y = shape_record_edge->shape_anchor_y - swf_tag_shape->_current_y; + signed anchor_delta_x = shape_record_edge->shape_anchor_x - shape_record_edge->shape_control_x; + signed anchor_delta_y = shape_record_edge->shape_anchor_y - shape_record_edge->shape_control_y; bitstream_putbits_signed(bs, control_delta_x, shape_coord_real_size); bitstream_putbits_signed(bs, control_delta_y, shape_coord_real_size); bitstream_putbits_signed(bs, anchor_delta_x, shape_coord_real_size);