1 /* { dg-options "-fno-tree-sra" } */
2 /* { dg-options "-fno-tree-sra -march=v32" { target cris-*-* } } */
3 typedef unsigned char byte;
4 typedef unsigned int uint;
5 typedef int bool;
6 typedef struct gs_const_string_s
7 {
8   const byte *data;
9 }
10 gs_const_string;
11 struct gs_matrix_s
12 {
13   float xx, xy, yx, yy, tx, ty;
14 };
15 typedef struct gs_matrix_s gs_matrix;
16 typedef long fixed;
17 typedef struct gs_fixed_point_s
18 {
19   fixed x, y;
20 }
21 gs_fixed_point;
22 typedef struct gs_matrix_fixed_s
23 {
24   int x;
25 }
26 gs_matrix_fixed;
27 int gx_path_add_curve_notes ();
28 static int
append_simple(const byte * glyph,const gs_matrix_fixed * pmat,void * ppath)29 append_simple (const byte * glyph, const gs_matrix_fixed * pmat, void * ppath)
30 {
31   int numContours =
32     (int) (((((uint) ((glyph)[0]) << 8) + (glyph)[1]) ^ 0x8000) - 0x8000);
33   const byte *pends = glyph + 10;
34   int code = 0;
35   {
36     uint i = 0;
37     uint np = 0;
38     gs_fixed_point pt = {0};
39     uint reps = 0;
40     for (i = 0, np = 0; i < numContours; ++i)
41       {
42 	bool move = ((bool) 1);
43 	uint last_point =
44 	  (((uint) ((pends + i * 2)[0]) << 8) + (pends + i * 2)[1]);
45 	int off_curve = 0;
46 	gs_fixed_point cpoints[3];
47 	for (; np <= last_point; --reps, ++np)
48 	  {
49 	    if (move)
50 	      {
51 		cpoints[0] = pt;
52 		move = ((bool) 0);
53 	      }
54 	    else
55 	      {
56 		switch (off_curve++)
57 		  {
58 		  default:
59 		    cpoints[2].x = ((cpoints[1].x + pt.x) / 2);
60 		    cpoints[2].y = ((cpoints[1].y + pt.y) / 2);
61 		    code =
62 		      gx_path_add_curve_notes (ppath,
63 					       ((cpoints[0].x +
64 						 2 * cpoints[1].x) / 3),
65 					       ((cpoints[0].y +
66 						 2 * cpoints[1].y) / 3),
67 					       ((2 * cpoints[1].x +
68 						 cpoints[2].x) / 3),
69 					       ((2 * cpoints[1].y +
70 						 cpoints[2].y) / 3),
71 					       cpoints[2].x, cpoints[2].y,
72 					       0);
73 		    cpoints[0] = cpoints[2];
74 		  case 0:
75 		    cpoints[1] = pt;
76 		  }
77 	      }
78 	  }
79       }
80   }
81 }
82 void gs_matrix_multiply (gs_matrix *, const gs_matrix *, gs_matrix *);
83 int
append_outline(uint glyph_index,const gs_matrix_fixed * pmat,void * ppath)84 append_outline (uint glyph_index, const gs_matrix_fixed *pmat, void *ppath)
85 {
86   gs_const_string glyph_string = {0};
87   int numContours = 0;
88   numContours =
89     (int) (((((uint) ((glyph_string.data)[0]) << 8) +
90 	     (glyph_string.data)[1]) ^ 0x8000) - 0x8000);
91   if (numContours >= 0)
92     return append_simple (glyph_string.data, pmat, ppath);
93   {
94     uint flags = 0;
95     do
96       {
97 	gs_matrix_fixed mat = {0};
98 	gs_matrix scale_mat = {0};
99 	gs_matrix_multiply (&scale_mat, (const gs_matrix *) &mat, (gs_matrix *) & mat);
100       }
101     while (flags & 32);
102   }
103 }
104