ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/image.C
(Generate patch)

Comparing deliantra/server/socket/image.C (file contents):
Revision 1.71 by root, Fri Nov 9 00:11:49 2012 UTC vs.
Revision 1.72 by root, Sun Nov 11 04:29:11 2012 UTC

56 const facedata *d = face_data (idx, ns->faceset); 56 const facedata *d = face_data (idx, ns->faceset);
57 57
58 if (!d) 58 if (!d)
59 return; // doh 59 return; // doh
60 60
61 /* cfperl_ix calls cf::face::ix which loads the data */
62 /* and then calls cf::client::send_ix to actually queue the ix */
63 cfperl_ix (ns, idx, pri, d->size, d->fofs);
64}
65
66void
67client::ix_send (faceidx idx, sint16 pri, SV *data_sv)
68{
69 STRLEN size;
70 char *data = SvPVbyte (data_sv, size);
61 client::ixsend ix; 71 ixsend ix;
62 72
63 ix.pri = pri; 73 ix.pri = pri;
64 ix.idx = idx; 74 ix.idx = idx;
65 ix.ofs = d->data.size (); 75 ix.ofs = size;
66 ix.data = d->data; 76 ix.data = (uint8 *)data;
77 ix.data_sv = SvREFCNT_inc (data_sv);
67 78
68 auto (pos, ns->ixface.end ()); 79 auto (pos, ixface.end ());
69 80
70 // the by far most common case will be to insert 81 // the by far most common case will be to insert
71 // near the end, so little looping. 82 // near the end, so little looping.
72 while (pos != ns->ixface.begin ()) 83 while (pos != ixface.begin ())
73 { 84 {
74 --pos; 85 --pos;
75 86
76 // sort within 2k bins, to slightly prefer smaller images 87 // sort within 2k bins, to slightly prefer smaller images
77 if (pri > pos->pri || (pri == pos->pri && (ix.ofs >> 11) <= (pos->ofs >> 11))) 88 if (pri > pos->pri || (pri == pos->pri && (ix.ofs >> 11) <= (pos->ofs >> 11)))
79 ++pos; 90 ++pos;
80 break; 91 break;
81 } 92 }
82 } 93 }
83 94
84 ns->ixface.insert (pos, ix); 95 ixface.insert (pos, ix);
85 96
86#if 0 97#if 0
87 for (auto (i, ns->ixface.begin ()); i != ns->ixface.end (); ++i) 98 for (auto (i, ixface.begin ()); i != ixface.end (); ++i)
88 fprintf (stderr, "<%d,%d> ", i->pri, i->ofs); 99 fprintf (stderr, "<%d,%d> ", i->pri, i->ofs);
89 fprintf (stderr, "\n"); 100 fprintf (stderr, "\n");
90#endif 101#endif
102}
103
104void
105client::ix_pop ()
106{
107 ixsend &ix = ixface.back ();
108
109 SvREFCNT_dec (ix.data_sv);
110
111 ixface.pop_back ();
91} 112}
92 113
93/** 114/**
94 * Sends a face offer (fx) to a client. 115 * Sends a face offer (fx) to a client.
95 * If nocache is true (nonzero), ignore the cache setting from the client - 116 * If nocache is true (nonzero), ignore the cache setting from the client -

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines