]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
add a third mode to call Font_Postprocess (NULL image, but pitch set)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 May 2011 05:02:02 +0000 (05:02 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 May 2011 05:02:02 +0000 (05:02 +0000)
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

ft2.c

diff --git a/ft2.c b/ft2.c
index 674f969e086ed228d63f81683c4f1facaa3a287e..57921c762057b903473a65e40218b8083fe1d5e2 100644 (file)
--- 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