From: divverent Date: Wed, 4 May 2011 05:02:02 +0000 (+0000) Subject: add a third mode to call Font_Postprocess (NULL image, but pitch set) X-Git-Tag: xonotic-v0.6.0~163^2~446 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=980d966f02dac2e06074d6538a57eb718d093505;p=xonotic%2Fdarkplaces.git add a third mode to call Font_Postprocess (NULL image, but pitch set) This performs the same padding calculation as if the image were set, but does not actually process git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11100 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/ft2.c b/ft2.c index 674f969e..57921c76 100644 --- a/ft2.c +++ b/ft2.c @@ -667,11 +667,13 @@ void Font_Postprocess_Update(ft2_font_t *fnt, int bpp, int w, int h) void Font_Postprocess(ft2_font_t *fnt, unsigned char *imagedata, int pitch, int bpp, int w, int h, int *pad_l, int *pad_r, int *pad_t, int *pad_b) { int x, y; + + // calculate gauss table Font_Postprocess_Update(fnt, bpp, w, h); + if(imagedata) { // enlarge buffer - // perform operation, not exceeding the passed padding values, // but possibly reducing them *pad_l = min(*pad_l, pp.padding_l); @@ -679,8 +681,6 @@ void Font_Postprocess(ft2_font_t *fnt, unsigned char *imagedata, int pitch, int *pad_t = min(*pad_t, pp.padding_t); *pad_b = min(*pad_b, pp.padding_b); - // calculate gauss table - // outline the font (RGBA only) if(bpp == 4 && (pp.outline > 0 || pp.blur > 0 || pp.shadowx != 0 || pp.shadowy != 0 || pp.shadowz != 0)) // we can only do this in BGRA { @@ -767,6 +767,15 @@ void Font_Postprocess(ft2_font_t *fnt, unsigned char *imagedata, int pitch, int } } } + else if(pitch) + { + // perform operation, not exceeding the passed padding values, + // but possibly reducing them + *pad_l = min(*pad_l, pp.padding_l); + *pad_r = min(*pad_r, pp.padding_r); + *pad_t = min(*pad_t, pp.padding_t); + *pad_b = min(*pad_b, pp.padding_b); + } else { // just calculate parameters