Fix headless and Python module build after recent alert icon changes

This commit is contained in:
Brecht Van Lommel 2020-03-18 13:29:49 +01:00
parent 0af739ae8a
commit d8897bed99
1 changed files with 22 additions and 24 deletions

View File

@ -177,30 +177,6 @@ static const IconType icontypes[] = {
# include "UI_icons.h"
};
/* ********** Alert Icons ********** */
# define ALERT_IMG_SIZE 256
ImBuf *UI_alert_image(eAlertIcon icon)
{
# ifdef WITH_HEADLESS
return NULL
# else
ImBuf *ibuf;
icon = MIN2(icon, ALERT_ICON_MAX - 1);
const int left = icon * ALERT_IMG_SIZE;
const rcti crop = {left, left + ALERT_IMG_SIZE - 1, 0, ALERT_IMG_SIZE - 1};
ibuf = IMB_ibImageFromMemory((const uchar *)datatoc_alert_icons_png,
datatoc_alert_icons_png_size,
IB_rect,
NULL,
"alert_icon");
IMB_rect_crop(ibuf, &crop);
IMB_premultiply_alpha(ibuf);
return ibuf;
# endif
}
/* **************************************************** */
static DrawInfo *def_internal_icon(
@ -2392,3 +2368,25 @@ void UI_icon_draw_ex(float x,
mono_color,
mono_border);
}
/* ********** Alert Icons ********** */
ImBuf *UI_alert_image(eAlertIcon icon)
{
#ifdef WITH_HEADLESS
return NULL;
#else
const int ALERT_IMG_SIZE = 256;
icon = MIN2(icon, ALERT_ICON_MAX - 1);
const int left = icon * ALERT_IMG_SIZE;
const rcti crop = {left, left + ALERT_IMG_SIZE - 1, 0, ALERT_IMG_SIZE - 1};
ImBuf *ibuf = IMB_ibImageFromMemory((const uchar *)datatoc_alert_icons_png,
datatoc_alert_icons_png_size,
IB_rect,
NULL,
"alert_icon");
IMB_rect_crop(ibuf, &crop);
IMB_premultiply_alpha(ibuf);
return ibuf;
#endif
}