Blender Git Loki

Git Commits -> Revision a56b72f

Revision a56b72f by Diego Borghetti (master)
April 22, 2010, 10:56 (GMT)
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders

Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.

To make blenfont thread safe I have to change two important things:

1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique

This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.

Why the BLF_*_unique function ?

Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.

Why don't remove the glyph cache ?

Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.

(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)

As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.

For now I test and work fine, so if some one found problem, please
let me know.

Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.

Commit Details:

Full Hash: a56b72fd82e5de17ad0f688857c31cf3a9623ea1
SVN Revision: 28341
Parent Commit: c8c22d2
Lines Changed: +414, -359

1 Added Path:

/source/blender/blenfont/BLF_types.h (+0, -0) (View)

16 Modified Paths:

/source/blender/blenfont/BLF_api.h (+31, -28) (Diff)
/source/blender/blenfont/intern/blf.c (+156, -104) (Diff)
/source/blender/blenkernel/intern/image.c (+42, -43) (Diff)
/source/blender/blenkernel/intern/image_gen.c (+28, -28) (Diff)
/source/blender/editors/interface/interface.c (+1, -1) (Diff)
/source/blender/editors/interface/interface_handlers.c (+4, -4) (Diff)
/source/blender/editors/interface/interface_regions.c (+2, -2) (Diff)
/source/blender/editors/interface/interface_style.c (+39, -41) (Diff)
/source/blender/editors/interface/interface_widgets.c (+18, -18) (Diff)
/source/blender/editors/interface/view2d.c (+7, -8) (Diff)
/source/blender/editors/space_console/console_draw.c (+16, -17) (Diff)
/source/blender/editors/space_file/filesel.c (+2, -2) (Diff)
/source/blender/editors/space_file/file_draw.c (+6, -4) (Diff)
/source/blender/editors/space_text/text_draw.c (+11, -14) (Diff)
/source/blender/python/generic/blf_api.c (+48, -42) (Diff)
/source/blender/windowmanager/intern/wm_operators.c (+3, -3) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021