From d8897bed994e5d5cd2314a965575ad9cf02a0be8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 18 Mar 2020 13:29:49 +0100 Subject: Fix headless and Python module build after recent alert icon changes --- source/blender/editors/interface/interface_icons.c | 46 +++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'source/blender/editors/interface/interface_icons.c') diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index ed4131440d5..3173c962830 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -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 +} -- cgit v1.2.3