From: Evert G. <eg...@dd...> - 2007-02-04 12:53:49
|
On Sunday 04 February 2007 13:28, Elias Pschernig wrote: > We use "color" spelling (c.f. bitmap_color_depth) so please also use it > for variable names :) Sorry, didn't pay particular attention to my spelling. > I'm also not very happy about the global variable, Neither am I, but... > as it makes it non thread safe (and grabbing two fonts from two threads > is probably as (un-)likely as grabbing them from system bitmaps..). It already isn't thread safe because of the import_x and import_y static variables, so my patch doesn't actually break anything in this sense. Also note that my patch isn't actually targeted at fixing a problem with grabbing fonts from system bitmaps (which I personally think is quite a stupid thing to do, let's not even go into video bitmaps here), but at not doing redundant work (ie, checking all pixels in the bitmap for an alpha value for each character grabbed from the font) in general, which also affects memory bitmaps. > So I would prefer to make it a function parameter to font_find_character > instead. I did, but it means adding it as an extra parameter to all the other functions that call font_find_character in order for it to be at all useful - which actually makes things much more messy than they are now. So while I agree that you're right in principle, I don't feel like making the change that way for now. If someone wants to redo the code in a thread-safe way that's fine with me, but I'm not doing it right now. Evert |