Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2019-09-14 03:22:42 +0300
committerRichard Antalik <richardantalik@gmail.com>2019-09-14 03:24:42 +0300
commita960dc451930796ca310cc88f00fb701374b2f7f (patch)
tree3bd2b69426bc36605792718e5b44e2917ac49427 /source/blender/blenfont/intern/blf_internal_types.h
parentab3a9dc1ed28d44bd71f5e255da74ef4d6f1fdbf (diff)
BLF: make library glyph cache handling thread-safe
Functions that utilize glyph cache should lock and unlock cache by calling `blf_glyph_cache_acquire()` and `blf_glyph_cache_release()`. Function `blf_glyph_cache_acquire()` will create glyph cache, if it doesn't exist. Locking mutex is global and shared by all fonts. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5701
Diffstat (limited to 'source/blender/blenfont/intern/blf_internal_types.h')
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 22950c26b6b..0294a6219b9 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -249,7 +249,9 @@ typedef struct FontBLF {
/* list of glyph cache for this font. */
ListBase cache;
- /* current glyph cache, size and dpi. */
+ /* current glyph cache, size and dpi.
+ * Use blf_glyph_cache_acquire(font) and blf_glyph_cache_release(font) to access cache!
+ */
GlyphCacheBLF *glyph_cache;
/* list of kerning cache for this font. */
@@ -272,6 +274,9 @@ typedef struct FontBLF {
/* data for buffer usage (drawing into a texture buffer) */
FontBufInfoBLF buf_info;
+
+ /* Mutex lock for glyph cache. */
+ SpinLock *glyph_cache_mutex;
} FontBLF;
typedef struct DirBLF {