Example #1
0
void BKE_previewimg_clear(struct PreviewImage *prv)
{
	int i;
	for (i = 0; i < NUM_ICON_SIZES; ++i) {
		BKE_previewimg_clear_single(prv, i);
	}
}
Example #2
0
static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
{
	ID *id = (ID *)ptr->id.data;
	PreviewImage *prv_img = (PreviewImage *)ptr->data;

	if (id != NULL) {
		BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
	}

	BKE_previewimg_clear_single(prv_img, size);

	if (values[0] && values[1]) {
		prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect");

		prv_img->w[size] = values[0];
		prv_img->h[size] = values[1];
	}

	prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
}
Example #3
0
static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size)
{
	ID *id = ptr->id.data;
	PreviewImage *prv_img = (PreviewImage *)ptr->data;

	if (id != NULL) {
		BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
	}

	if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) || (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) {
		return;
	}

	if (value)
		prv_img->flag[size] |= PRV_USER_EDITED;
	else
		prv_img->flag[size] &= ~PRV_USER_EDITED;

	prv_img->flag[size] |= PRV_CHANGED;

	BKE_previewimg_clear_single(prv_img, size);
}