Unbreak WITH_HEADLESS builds
This commit is contained in:
@@ -33,8 +33,6 @@ set(LIB
|
||||
PRIVATE bf::dna
|
||||
bf_gpu
|
||||
PRIVATE bf::intern::guardedalloc
|
||||
PRIVATE bf::extern::nanosvg
|
||||
PRIVATE bf::editor::datafiles
|
||||
${FREETYPE_LIBRARIES} ${BROTLI_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -51,6 +49,16 @@ if(WITH_PYTHON)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_HEADLESS)
|
||||
add_definitions(-DWITH_HEADLESS)
|
||||
else()
|
||||
# SVG icons.
|
||||
list(APPEND LIB
|
||||
PRIVATE bf::extern::nanosvg
|
||||
PRIVATE bf::editor::datafiles
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
add_library(bf::blenfont ALIAS bf_blenfont)
|
||||
|
||||
@@ -612,6 +612,7 @@ int BLF_draw_mono(int fontid, const char *str, const size_t str_len, int cwidth,
|
||||
void BLF_draw_svg_icon(
|
||||
uint icon_id, float x, float y, float size, float color[4], float outline_alpha)
|
||||
{
|
||||
#ifndef WITH_HEADLESS
|
||||
FontBLF *font = global_font[0];
|
||||
if (font) {
|
||||
/* Avoid bgl usage to corrupt BLF drawing. */
|
||||
@@ -620,14 +621,21 @@ void BLF_draw_svg_icon(
|
||||
blf_draw_svg_icon(font, icon_id, x, y, size, color, outline_alpha);
|
||||
blf_draw_gpu__end(font);
|
||||
}
|
||||
#else
|
||||
UNUSED_VARS(icon_id, x, y, size, color, outline_alpha);
|
||||
#endif /* WITH_HEADLESS */
|
||||
}
|
||||
|
||||
blender::Array<uchar> BLF_svg_icon_bitmap(uint icon_id, float size, int *r_width, int *r_height)
|
||||
{
|
||||
#ifndef WITH_HEADLESS
|
||||
FontBLF *font = global_font[0];
|
||||
if (font) {
|
||||
return blf_svg_icon_bitmap(font, icon_id, size, r_width, r_height);
|
||||
}
|
||||
#else
|
||||
UNUSED_VARS(icon_id, size, r_width, r_height);
|
||||
#endif /* WITH_HEADLESS */
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -524,6 +524,7 @@ int blf_font_draw_mono(
|
||||
return columns;
|
||||
}
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
void blf_draw_svg_icon(
|
||||
FontBLF *font, uint icon_id, float x, float y, float size, float color[4], float outline_alpha)
|
||||
{
|
||||
@@ -595,6 +596,7 @@ blender::Array<uchar> blf_svg_icon_bitmap(
|
||||
blf_glyph_cache_release(font);
|
||||
return bitmap;
|
||||
}
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
@@ -41,12 +41,14 @@
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_string_utf8.h"
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
# include "nanosvgrast.h"
|
||||
|
||||
# include "svg_icons.h"
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
#include "BLI_strict_flags.h" /* Keep last. */
|
||||
|
||||
#include "nanosvgrast.h"
|
||||
|
||||
#include "svg_icons.h"
|
||||
|
||||
/**
|
||||
* Convert glyph coverage amounts to lightness values. Uses a LUT that perceptually improves
|
||||
* anti-aliasing and results in text that looks a bit fuller and slightly brighter. This should
|
||||
@@ -336,6 +338,7 @@ static GlyphBLF *blf_glyph_cache_add_glyph(
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
static GlyphBLF *blf_glyph_cache_add_blank(GlyphCacheBLF *gc, uint charcode)
|
||||
{
|
||||
/* Add an empty GlyphBLF to the cache and return it. With
|
||||
@@ -430,6 +433,7 @@ static GlyphBLF *blf_glyph_cache_add_svg(GlyphCacheBLF *gc, uint charcode, bool
|
||||
gc->glyphs.add(key, std::move(g));
|
||||
return result;
|
||||
}
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1384,6 +1388,7 @@ GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode
|
||||
return g;
|
||||
}
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
GlyphBLF *blf_glyph_ensure_icon(GlyphCacheBLF *gc, const uint icon_id, bool color)
|
||||
{
|
||||
GlyphBLF *g = blf_glyph_cache_find_glyph(gc, icon_id + BLF_ICON_OFFSET, 0);
|
||||
@@ -1392,6 +1397,7 @@ GlyphBLF *blf_glyph_ensure_icon(GlyphCacheBLF *gc, const uint icon_id, bool colo
|
||||
}
|
||||
return blf_glyph_cache_add_svg(gc, icon_id + BLF_ICON_OFFSET, color);
|
||||
}
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
#ifdef BLF_SUBPIXEL_AA
|
||||
GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
|
||||
|
||||
Reference in New Issue
Block a user