SimplyImage *simply_res_auto_image(SimplyRes *self, uint32_t id, bool is_placeholder) { if (!id) { return NULL; } SimplyImage *image = (SimplyImage*) list1_find(self->images, id_filter, (void*)(uintptr_t) id); if (image) { return image; } if (id <= self->num_bundled_res) { return simply_res_add_bundled_image(self, id); } if (is_placeholder) { return simply_res_add_image(self, id, 0, 0, NULL, 0); } return NULL; }
GBitmap *simply_res_auto_image(SimplyRes *self, uint32_t id, bool is_placeholder) { if (!id) { return NULL; } SimplyImage *image = (SimplyImage*) list1_find(self->images, id_filter, (void*)(uintptr_t) id); if (image) { return &image->bitmap; } if (id <= ARRAY_LENGTH(resource_crc_table)) { return simply_res_add_bundled_image(self, id); } if (!image && is_placeholder) { return simply_res_add_image(self, id, 0, 0, NULL); } return NULL; }
static void handle_image_packet(Simply *simply, Packet *data) { ImagePacket *packet = (ImagePacket*) data; simply_res_add_image(simply->res, packet->id, packet->width, packet->height, packet->pixels); }