static void rna_Image_gl_free(Image *image) { GPU_free_image(image); /* remove the nocollect flag, image is available for garbage collection again */ image->flag &= ~IMA_NOCOLLECT; }
static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) { Image *ima = ptr->id.data; ImBuf *ibuf; void *lock; int i, size; ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); if (ibuf) { size = ibuf->x * ibuf->y * ibuf->channels; if (ibuf->rect_float) { memcpy(ibuf->rect_float, values, sizeof(float) * size); } else { for (i = 0; i < size; i++) ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]); } ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID; BKE_image_mark_dirty(ima, ibuf); if (!G.background) { GPU_free_image(ima); } WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); } BKE_image_release_ibuf(ima, ibuf, lock); }
/* force OpenGL reload */ static void refresh_images(BakeImages *bake_images) { int i; for (i = 0; i < bake_images->size; i++) { Image *ima = bake_images->data[i].image; if (ima->ok == IMA_OK_LOADED) { GPU_free_image(ima); DAG_id_tag_update(&ima->id, 0); } } }