static inline size_t data_append(struct slot_map* sm, void* data) { if (sm->capacity - sm->size < 1) data_resize(sm, sm->capacity * 2); if (data) memcpy(sm->data + sm->size * sm->esz, data, sm->esz); return sm->size++; }
wxImage BorderInvariantResizeImage(const wxImage& image, int width, int height) { if (!image.IsOk() || (width == image.GetWidth() && height == image.GetHeight())) return image; wxImage ret(width, height); Resizer data_resize(ret, image, false); data_resize(); if (image.HasAlpha()) { ret.InitAlpha(); Resizer alpha_resize(ret, image, true); alpha_resize(); } return ret; }
void slot_map_init(struct slot_map* sm, size_t esz) { sm->esz = esz; sm->num_slots = 0; sm->size = 0; sm->cap_slots = 0; sm->capacity = 0; sm->slots = 0; sm->data_to_slot = 0; sm->data = 0; sm->free_list_head = INVALID_IDX; sm->free_list_tail = INVALID_IDX; slots_resize(sm, INITIAL_CAPACITY); data_resize(sm, INITIAL_CAPACITY); }
//------------------------------------------------------------------------------------- TCPPacket::TCPPacket(MessageID msgID, size_t res): Packet(msgID, true, res) { data_resize(PACKET_MAX_SIZE_TCP * 4); wpos(0); }
//------------------------------------------------------------------------------------- void TCPPacket::onReclaimObject() { Packet::onReclaimObject(); data_resize(maxBufferSize()); }
//------------------------------------------------------------------------------------- TCPPacket::TCPPacket(MessageID msgID, size_t res): Packet(msgID, true, res) { data_resize(maxBufferSize()); wpos(0); }
//------------------------------------------------------------------------------------- UDPPacket::UDPPacket(MessageID msgID, size_t res): Packet(msgID, false, res) { data_resize(PACKET_MAX_SIZE_UDP); wpos(0); }
//------------------------------------------------------------------------------------- UDPPacket::UDPPacket(MessageID msgID, size_t res): Packet(msgID, false, res) { data_resize(maxBufferSize()); wpos(0); }