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