… | |
… | |
10 | } rc_t; |
10 | } rc_t; |
11 | |
11 | |
12 | typedef SV rc_array_t; |
12 | typedef SV rc_array_t; |
13 | |
13 | |
14 | static rc_t * |
14 | static rc_t * |
15 | rc_alloc () |
15 | rc_alloc (void) |
16 | { |
16 | { |
17 | rc_t *rc = g_slice_new0 (rc_t); |
17 | rc_t *rc = g_slice_new0 (rc_t); |
18 | rc->hv = newHV (); |
18 | rc->hv = newHV (); |
19 | |
19 | |
20 | return rc; |
20 | return rc; |
… | |
… | |
76 | } |
76 | } |
77 | |
77 | |
78 | static void |
78 | static void |
79 | rc_glyph (rc_array_t *arr, int u, int v, int w, int h, int x, int y) |
79 | rc_glyph (rc_array_t *arr, int u, int v, int w, int h, int x, int y) |
80 | { |
80 | { |
|
|
81 | if (w && h) |
|
|
82 | { |
81 | U8 *c; |
83 | U8 *c; |
82 | STRLEN len = SvCUR (arr); |
84 | STRLEN len = SvCUR (arr); |
83 | SvGROW (arr, len + 2 * 2 + 1 * 4); |
85 | SvGROW (arr, len + 2 * 2 + 1 * 4); |
84 | c = (U8 *)SvEND (arr); |
86 | c = (U8 *)SvEND (arr); |
85 | |
87 | |
86 | x += w; |
88 | x += w; |
87 | y += h; |
89 | y += h; |
88 | |
90 | |
89 | *c++ = u; |
91 | *c++ = u; |
90 | *c++ = v; |
92 | *c++ = v; |
91 | *c++ = w; |
93 | *c++ = w; |
92 | *c++ = h; |
94 | *c++ = h; |
93 | |
95 | |
94 | // use ber-encoding for up to 14 bits (16k) |
96 | // use ber-encoding for up to 14 bits (16k) |
95 | *c = 0x80 | (x >> 7); c += (x >> 7) ? 1 : 0; *c++ = x & 0x7f; |
97 | *c = 0x80 | (x >> 7); c += (x >> 7) ? 1 : 0; *c++ = x & 0x7f; |
96 | *c = 0x80 | (y >> 7); c += (y >> 7) ? 1 : 0; *c++ = y & 0x7f; |
98 | *c = 0x80 | (y >> 7); c += (y >> 7) ? 1 : 0; *c++ = y & 0x7f; |
97 | |
99 | |
98 | SvCUR_set (arr, c - (U8 *)SvPVX (arr)); |
100 | SvCUR_set (arr, c - (U8 *)SvPVX (arr)); |
|
|
101 | } |
99 | } |
102 | } |
100 | |
103 | |
101 | static void |
104 | static void |
102 | rc_draw (rc_t *rc) |
105 | rc_draw (rc_t *rc) |
103 | { |
106 | { |