diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2026-09-26 15:29:11 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2026-10-01 13:29:27 +0200 |
| commit | 895c5004a106176b8dc891ea60c272dfa4802dd6 (patch) | |
| tree | d9ce62d85f576595c4d3be2aef33f08f055768cf | |
| parent | fb60517c20031b78edd4edc934b59379e3c79c08 (diff) | |
wip
| -rw-r--r-- | README.md | 20 | ||||
| -rw-r--r-- | include/vkvg.h | 2 | ||||
| -rw-r--r-- | src/vkvg_fonts.c | 12 | ||||
| -rw-r--r-- | src/vkvg_fonts.h | 20 | ||||
| -rw-r--r-- | src/vkvg_internal.h | 2 | ||||
| -rw-r--r-- | src/vkvg_matrix.c | 2 |
6 files changed, 29 insertions, 29 deletions
@@ -1,7 +1,7 @@ <h1 align="center"> <br> - <a href="https://github.com/jpbruyere/vkvg/blob/master/vkvg.svg"> - <img src="https://github.com/jpbruyere/vkvg/blob/master/vkvg.svg?sanitize=true" alt="vkvg" width="140"> + <a href="vkvg.svg"> + <img src="vkvg.svg?sanitize=true" alt="vkvg" width="140"> </a> <br> <br> @@ -37,22 +37,22 @@ The **API** follows the same pattern as [Cairo](https://www.cairographics.org/), In progress API documentation is available online at http://vkvg.org. <p align="center"> - <a href="https://github.com/jpbruyere/vkvg/blob/master/vkvg-tiger.png"> - <kbd><img src="https://github.com/jpbruyere/vkvg/blob/master/vkvg-tiger.png" height="260"></kbd> + <a href="vkvg-tiger.png"> + <img src="vkvg-tiger.png" height="260"> </a> - <a href="https://github.com/jpbruyere/vkvg/blob/master/screenshot3.png"> - <kbd><img src="https://raw.githubusercontent.com/jpbruyere/vkvg/master/screenshot3.png" height="260"></kbd> + <a href="screenshot3.png"> + <img src="screenshot3.png" height="260"> </a> - <a href="https://github.com/jpbruyere/vkvg/blob/master/screenshot1.png"> - <kbd><img src="https://github.com/jpbruyere/vkvg/blob/master/screenshot1.png" height="260"></kbd> + <a href="screenshot1.png"> + <img src="screenshot1.png" height="260"> </a> </p> ## Performance comparison <p align="center"> - <a href="https://github.com/jpbruyere/vgperf/blob/master/vgperf.png"> - <kbd><img src="https://raw.githubusercontent.com/jpbruyere/vgperf/master/vgperf.png" height="300"></kbd> + <a href="vgperf.png"> + <kbd><img src="vgperf.png" height="300"></kbd> </a> <br>major libs perf comparison</br> </p> diff --git a/include/vkvg.h b/include/vkvg.h index 4deef25..51d0754 100644 --- a/include/vkvg.h +++ b/include/vkvg.h @@ -478,7 +478,7 @@ vkvg_public void vkvg_matrix_rotate(vkvg_matrix_t* matrix, float radians); * @param a first operand of the multiplication * @param b second operand of the multiplication */ -vkvg_public void vkvg_matrix_multiply(vkvg_matrix_t* result, const vkvg_matrix_t* a, const vkvg_matrix_t* b); +vkvg_public void vkvg_matrix_multiply(vkvg_matrix_t* result, const vkvg_matrix_t * const a, const vkvg_matrix_t * const b); /** * @brief transform distances * diff --git a/src/vkvg_fonts.c b/src/vkvg_fonts.c index d9d9042..a676ed8 100644 --- a/src/vkvg_fonts.c +++ b/src/vkvg_fonts.c @@ -371,12 +371,12 @@ _char_ref* _prepare_char(VkvgDevice dev, VkvgText tr, uint32_t gindex) { return cr; } void _font_add_name(_vkvg_font_identity_t* font, const char* name) { - if (++font->namesCount == 1) + /*if (++font->namesCount == 1) font->names = (char**)malloc(sizeof(char*)); else font->names = (char**)realloc(font->names, font->namesCount * sizeof(char*)); font->names[font->namesCount - 1] = (char*)calloc(strlen(name) + 1, sizeof(char)); - strcpy(font->names[font->namesCount - 1], name); + strcpy(font->names[font->namesCount - 1], name);*/ } bool _font_cache_load_font_file_in_memory(_vkvg_font_identity_t* fontId) { FILE* fontFile = fopen(fontId->fontFile, "rb"); @@ -482,7 +482,7 @@ bool _tryResolveFontNameWithFontConfig(VkvgContext ctx, _vkvg_font_identity_t** _font_cache_t* cache = (_font_cache_t*)ctx->dev->fontCache; char* fontFile = NULL; - FcPattern* pat = FcNameParse((const FcChar8*)ctx->selectedFontName); + /*FcPattern* pat = FcNameParse((const FcChar8*)ctx->selectedFontName); FcConfigSubstitute(cache->config, pat, FcMatchPattern); FcDefaultSubstitute(pat); FcResult result; @@ -508,7 +508,7 @@ bool _tryResolveFontNameWithFontConfig(VkvgContext ctx, _vkvg_font_identity_t** } FcPatternDestroy(pat); - FcPatternDestroy(font); + FcPatternDestroy(font);*/ return (fontFile != NULL); } @@ -516,7 +516,7 @@ bool _tryResolveFontNameWithFontConfig(VkvgContext ctx, _vkvg_font_identity_t** // try to find corresponding font in cache (defined by context selectedFont) and create a new font entry if not found. void _update_current_font(VkvgContext ctx) { - if (ctx->currentFont == NULL) { + /*if (ctx->currentFont == NULL) { LOCK_FONTCACHE(ctx->dev) if (ctx->selectedFontName[0] == 0) _select_font_face(ctx, "sans"); @@ -534,7 +534,7 @@ void _update_current_font(VkvgContext ctx) { ctx->currentFontSize = _find_or_create_font_size(ctx); UNLOCK_FONTCACHE(ctx->dev) - } + }*/ } #ifdef VKVG_USE_HARFBUZZ diff --git a/src/vkvg_fonts.h b/src/vkvg_fonts.h index 4138ae1..60fd80f 100644 --- a/src/vkvg_fonts.h +++ b/src/vkvg_fonts.h @@ -93,7 +93,7 @@ static const uint8_t utf8d[] = { * @param byte The raw next byte from the UTF-8 stream. * @return uint32_t Returns UTF8_ACCEPT when a character is fully decoded. */ -inline uint32_t decode_utf8_byte(uint32_t *const restrict state, uint32_t *const restrict codep, uint8_t byte) { +static inline uint32_t decode_utf8_byte(uint32_t *const restrict state, uint32_t *const restrict codep, uint8_t byte) { uint32_t type = utf8d[byte]; *codep = (*state != UTF8_ACCEPT) ? @@ -178,7 +178,7 @@ typedef struct { /* Font identification structure */ typedef struct { uint64_t names[5]; /* Resolved Input names to this font by fontConfig or custom name set by @ref vkvg_load_from_path. Maximum count is 5.*/ - uint32_t namesCount; /* Count of resolved names by fontConfig */ + uint32_t namesCount; /* Count of resolved names by fontConfig */ unsigned char* fontBuffer; /* stb_truetype in memory buffer */ long fontBufSize; /* */ char* fontFile; /* Font file full path*/ @@ -202,20 +202,20 @@ typedef struct { FcConfig* config; /* Font config, used to find font files by font names*/ #endif - int stagingX; /* x pen in host buffer */ - uint8_t* hostBuff; /* host memory where bitmaps are first loaded */ + int stagingX; /* x pen in host buffer */ + uint8_t* hostBuff; /* host memory where bitmaps are first loaded */ VkCommandBuffer cmd; /* vulkan command buffer for font textures upload */ vkh_buffer_t buff; /* stagin buffer */ VkhImage texture; /* 2d array texture used by contexts to draw characteres */ VkFormat texFormat; /* Format of the fonts texture array */ uint8_t texPixelSize; /* Size in byte of a single pixel in a font texture */ - uint8_t texLength; /* layer count of 2d array texture, starts with FONT_CACHE_INIT_LAYERS count and increased when - needed */ - int* pensY; /* array of current y pen positions for each texture in cache 2d array */ - VkFence uploadFence; /* Signaled when upload is finished */ - mtx_t mutex; /* font cache global mutex, used only if device is in thread aware mode (see: - vkvg_device_set_thread_aware) */ + uint8_t texLength; /* layer count of 2d array texture, starts with FONT_CACHE_INIT_LAYERS count and increased when + needed */ + int* pensY; /* array of current y pen positions for each texture in cache 2d array */ + VkFence uploadFence; /* Signaled when upload is finished */ + mtx_t mutex; /* font cache global mutex, used only if device is in thread aware mode (see: + vkvg_device_set_thread_aware) */ _vkvg_font_identity_t* fonts; /* Loaded fonts structure array */ int32_t fontsCount; /* Loaded fonts array count*/ diff --git a/src/vkvg_internal.h b/src/vkvg_internal.h index 876e2d8..dfafd48 100644 --- a/src/vkvg_internal.h +++ b/src/vkvg_internal.h @@ -59,7 +59,7 @@ * @param str Pointer to the start of the null terminated ascii string to hash. * @return uint64_t The 64-bit hash value. */ -inline uint64_t fnv1a_64_str(const char *const restrict str) { +static inline uint64_t fnv1a_64_str(const char *const restrict str) { uint64_t hash = 0xcbf29ce484222325ULL; const uint8_t *restrict data = (const uint8_t *)str; diff --git a/src/vkvg_matrix.c b/src/vkvg_matrix.c index 600bf7e..e15007a 100644 --- a/src/vkvg_matrix.c +++ b/src/vkvg_matrix.c @@ -190,7 +190,7 @@ void vkvg_matrix_rotate(vkvg_matrix_t* matrix, float radians) { vkvg_matrix_multiply(matrix, &tmp, matrix); } -void vkvg_matrix_multiply(vkvg_matrix_t* result, const vkvg_matrix_t* a, const vkvg_matrix_t* b) { +void vkvg_matrix_multiply(vkvg_matrix_t* result, const vkvg_matrix_t *const a, const vkvg_matrix_t *const b) { vkvg_matrix_t r; r.xx = a->xx * b->xx + a->yx * b->xy; |