[Swfed-svn] swfed-svn [160] build, print 処理を実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 19日 (金) 00:57:38 JST


Revision: 160
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=160
Author:   yoya
Date:     2009-06-19 00:57:38 +0900 (Fri, 19 Jun 2009)

Log Message:
-----------
build, print 処理を実装

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	2009-06-18 15:57:25 UTC (rev 159)
+++ trunk/src/swf_shape_record_edge.c	2009-06-18 15:57:38 UTC (rev 160)
@@ -5,8 +5,13 @@
 int
 swf_shape_record_edge_parse(bitstream_t *bs,
                             swf_shape_record_edge_t *shape_record_edge) {
+    int result;
     unsigned int shape_coord_real_size;
-    shape_record_edge->shape_record_type = bitstream_getbit(bs);
+    result = bitstream_getbit(bs);
+    if (result == -1) {
+        return 1;
+    }
+    shape_record_edge->shape_record_type = result;
     shape_record_edge->shape_edge_type   = bitstream_getbit(bs);
     shape_record_edge->shape_coord_size  = bitstream_getbits(bs, 4);
     shape_coord_real_size = shape_record_edge->shape_coord_size + 2;
@@ -35,13 +40,71 @@
 int
 swf_shape_record_edge_build(bitstream_t *bs,
                             swf_shape_record_edge_t *shape_record_edge) {
-    fprintf(stderr, "swf_shape_record_edge_build: not implemented yet\n");
+//    int result;
+    unsigned int shape_coord_real_size;
+    bitstream_putbit(bs, shape_record_edge->shape_record_type);
+    bitstream_putbit(bs, shape_record_edge->shape_edge_type);
+    bitstream_putbits(bs, shape_record_edge->shape_coord_size, 4);
+    shape_coord_real_size = shape_record_edge->shape_coord_size + 2;
+    if (shape_record_edge->shape_edge_type == 0) {
+        bitstream_putbits(bs, shape_record_edge->shape_control_delta_x, shape_coord_real_size);
+        bitstream_putbits(bs, shape_record_edge->shape_control_delta_y, shape_coord_real_size);
+        bitstream_putbits(bs, shape_record_edge->shape_anchor_delta_x, shape_coord_real_size);
+        bitstream_putbits(bs, shape_record_edge->shape_anchor_delta_y, shape_coord_real_size);
+    } else {
+        bitstream_putbit(bs, shape_record_edge->shape_line_has_x_and_y);
+        if (shape_record_edge->shape_line_has_x_and_y == 1) {
+            bitstream_putbits(bs, shape_record_edge->shape_delta_x, shape_coord_real_size);
+            bitstream_putbits(bs, shape_record_edge->shape_delta_y, shape_coord_real_size);
+        } else {
+            bitstream_putbit(bs, shape_record_edge->shape_line_has_x_or_y);
+            if (shape_record_edge->shape_line_has_x_or_y == 0) {
+                bitstream_putbits(bs, shape_record_edge->shape_delta_x, shape_coord_real_size);
+            } else {
+                bitstream_putbits(bs, shape_record_edge->shape_delta_y, shape_coord_real_size);
+            }
+        }
+    }
     return 0;
 }
 
 int
 swf_shape_record_edge_print(swf_shape_record_edge_t *shape_record_edge,
                             int indent_depth) {
-    fprintf(stderr, "swf_shape_record_edge_print: not implemented yet\n");
+    print_indent(indent_depth);
+    printf("shape_record_type=%d  shape_edge_type=%d  shape_coord_size=%d+2\n", shape_record_edge->shape_record_type,
+           shape_record_edge->shape_edge_type ,
+           shape_record_edge->shape_coord_size);
+    if (shape_record_edge->shape_edge_type == 0) {
+        print_indent(indent_depth);
+        printf("shape_control_delta_(x,y)=(%d,%d)  shape_anchor_delta_(x,y)=(%d,%d)\n",
+               shape_record_edge->shape_control_delta_x,
+               shape_record_edge->shape_control_delta_y,
+               shape_record_edge->shape_anchor_delta_x,
+               shape_record_edge->shape_anchor_delta_y);
+    } else {
+        print_indent(indent_depth);
+        printf("shape_line_has_x_and_y=%d\n",
+               shape_record_edge->shape_line_has_x_and_y);
+        if (shape_record_edge->shape_line_has_x_and_y == 1) {
+            print_indent(indent_depth);
+            printf("shape_delta_(x,y)=(%d,%d)\n",
+                   shape_record_edge->shape_delta_x,
+                   shape_record_edge->shape_delta_y);
+        } else {
+            print_indent(indent_depth);
+            printf("shape_line_has_x_or_y=%d\n",
+                   shape_record_edge->shape_line_has_x_or_y);
+            if (shape_record_edge->shape_line_has_x_or_y == 0) {
+                print_indent(indent_depth);
+                printf("shape_delta_x=%d\n",
+                       shape_record_edge->shape_delta_x);
+            } else {
+                print_indent(indent_depth);
+                printf("shape_delta_y=%d\n",
+                       shape_record_edge->shape_delta_y);
+            }
+        }
+    }
     return 0;
 }



Swfed-svn メーリングリストの案内
Back to archive index