ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/rendercache.c
(Generate patch)

Comparing deliantra/Deliantra-Client/rendercache.c (file contents):
Revision 1.6 by root, Sun Aug 12 12:14:01 2007 UTC vs.
Revision 1.9 by root, Sun Jan 13 08:31:45 2008 UTC

1typedef struct { 1typedef struct {
2 GLenum mode; 2 GLenum mode;
3 GLenum format; // 0, GL_T2F_V3F, GL_V2F 3 GLenum format; // 0, GL_T2F_V3F, GL_V2F
4 GLint texname; 4 GLuint texname;
5 unsigned char r, g, b, a; 5 unsigned char r, g, b, a;
6} rc_key_t; 6} rc_key_t;
7 7
8typedef struct { 8typedef struct {
9 HV *hv; 9 HV *hv;
10} rc_t; 10} rc_t;
11 11
12typedef SV rc_array_t; 12typedef SV rc_array_t;
13 13
14static rc_t * 14static rc_t *
15rc_alloc () 15rc_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
78static void 78static void
79rc_glyph (rc_array_t *arr, int u, int v, int w, int h, int x, int y) 79rc_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
101static void 104static void
102rc_draw (rc_t *rc) 105rc_draw (rc_t *rc)
103{ 106{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines