Exemple #1
0
static inline Texture *TxDefault(Texture *tx)
{
  memset((char *)tx, 0, sizeof(Texture));
  RefInit((Ref *)tx, TXMAGIC);
  TmIdentity(tx->tfm);
  DblListInit(&tx->loadnode);
  return tx;
}
Exemple #2
0
static bool create_Apply(struct pool_plugin *_p, struct LogEntry *e, uint32_t state)
{
    struct pool_plugin_create *p = (struct pool_plugin_create *) _p;
    uint16_t i, logsize, datasize = 0;
    uint16_t lengths[32];
    p->context = p->finit(p->context, state);
    logsize  = p->write_size(p->context, state, lengths);
    for (i = 0; i < logsize; ++i) {
        datasize += lengths[i*2+0];
        datasize += lengths[i*2+1];
    }
    uint16_t entry_size = sizeof(struct LogEntry)+sizeof(uint16_t)*2*logsize+datasize;
    struct LogEntry *newe = malloc(entry_size);
    char *buf = emit_message_header((char *)&newe->data, LOGPOOL_EVENT_WRITE, logsize, lengths);
    newe->h.size = entry_size;
    newe->h.next = NULL;
    newe->h.time = e->h.time;
    p->write_data(p->context, e, buf);
    RefInit(newe);
    p->context = p->fexit(p->context);
    p->base.apply->Apply(p->base.apply, newe, 0);
    return true;
}