fix for header/imp usage

Signed-off-by: 倪庆亮 <qingliang.ni@magewell.com>
This commit is contained in:
倪庆亮 2023-08-16 17:23:44 +08:00
parent 65dd91bed2
commit 151fceb45d
4 changed files with 21 additions and 6 deletions

View File

@ -298,6 +298,10 @@ nk_combo_begin_symbol(struct nk_context *ctx, enum nk_symbol_type symbol, struct
nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color);
nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color);
break;
default:
NK_ASSERT(0);
sym_background = nk_rgba(0, 0, 0, 0);
break;
}
{
struct nk_rect bounds = {0,0,0,0};
@ -395,6 +399,10 @@ nk_combo_begin_symbol_text(struct nk_context *ctx, const char *selected, int len
nk_fill_rect(&win->buffer, header, style->combo.rounding, background->data.color);
nk_stroke_rect(&win->buffer, header, style->combo.rounding, style->combo.border, style->combo.border_color);
break;
default:
NK_ASSERT(0);
text.background = nk_rgba(0, 0, 0, 0);
break;
}
{
struct nk_rect content;

View File

@ -121,15 +121,21 @@ NK_LIB int nk_to_upper(int c);
NK_LIB int nk_to_lower(int c);
#ifndef NK_MEMCPY
#define NK_MEMCPY_IMP
#define NK_MEMCPY nk_memcopy
NK_LIB void* nk_memcopy(void *dst, const void *src, nk_size n);
#endif
#ifndef NK_MEMSET
#define NK_MEMSET_IMP
#define NK_MEMSET nk_memset
NK_LIB void nk_memset(void *ptr, int c0, nk_size size);
#endif
NK_LIB void nk_zero(void *ptr, nk_size size);
NK_LIB char *nk_itoa(char *s, long n);
NK_LIB int nk_string_float_limit(char *string, int prec);
#ifndef NK_DTOA
#define NK_DTOA_IMP
#define NK_DTOA nk_dtoa
NK_LIB char *nk_dtoa(char *s, double n);
#endif
NK_LIB int nk_text_clamp(const struct nk_user_font *font, const char *text, int text_len, float space, int *glyphs, float *text_width, nk_rune *sep_list, int sep_count);

View File

@ -55,6 +55,10 @@ nk_draw_selectable(struct nk_command_buffer *out,
text.background = background->data.color;
nk_fill_rect(out, *bounds, style->rounding, background->data.color);
break;
default:
NK_ASSERT(0);
text.background = nk_rgba(0, 0, 0, 0);
break;
}
if (icon) {
if (img) nk_draw_image(out, *icon, img, nk_white);

View File

@ -13,8 +13,7 @@ NK_LIB nk_bool nk_is_upper(int c){return (c >= 'A' && c <= 'Z') || (c >= 0xC0 &&
NK_LIB int nk_to_upper(int c) {return (c >= 'a' && c <= 'z') ? (c - ('a' - 'A')) : c;}
NK_LIB int nk_to_lower(int c) {return (c >= 'A' && c <= 'Z') ? (c - ('a' + 'A')) : c;}
#ifndef NK_MEMCPY
#define NK_MEMCPY nk_memcopy
#ifdef NK_MEMCPY_IMP
NK_LIB void*
nk_memcopy(void *dst0, const void *src0, nk_size length)
{
@ -72,8 +71,7 @@ done:
return (dst0);
}
#endif
#ifndef NK_MEMSET
#define NK_MEMSET nk_memset
#ifdef NK_MEMSET_IMP
NK_LIB void
nk_memset(void *ptr, int c0, nk_size size)
{
@ -499,8 +497,7 @@ nk_itoa(char *s, long n)
nk_strrev_ascii(s);
return s;
}
#ifndef NK_DTOA
#define NK_DTOA nk_dtoa
#ifdef NK_DTOA_IMP
NK_LIB char*
nk_dtoa(char *s, double n)
{