Move shadow option (for text) from editor/interface to blenfont.
[blender.git] / source / blender / editors / interface / interface_style.c
index 831a8a5bf6c7a7c1181012e44e212842d848d3cd..0d30d8e69c02b447c395e316da86153ac410cd44 100644 (file)
@@ -145,22 +145,6 @@ static uiFont *uifont_to_blfont(int id)
 
 /* *************** draw ************************ */
 
-static void ui_font_shadow_draw(uiFontStyle *fs, int x, int y, char *str)
-{
-       float color[4];
-       
-       glGetFloatv(GL_CURRENT_COLOR, color);
-       
-       glColor4f(fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
-       
-       BLF_blur(fs->shadow);
-       BLF_position(x+fs->shadx, y+fs->shady, 0.0f);
-       BLF_draw(str);
-       BLF_blur(0);
-       
-       glColor4fv(color);
-}
-
 void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
 {
        float height;
@@ -179,14 +163,18 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
        /* clip is very strict, so we give it some space */
        BLF_clipping(rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4);
        BLF_enable(BLF_CLIPPING);
-       
-       if(fs->shadow) 
-               ui_font_shadow_draw(fs, rect->xmin+xofs, rect->ymin+yofs, str);
-       
        BLF_position(rect->xmin+xofs, rect->ymin+yofs, 0.0f);
-       BLF_draw(str);
 
+       if (fs->shadow) {
+               BLF_enable(BLF_SHADOW);
+               BLF_shadow(fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
+               BLF_shadow_offset(fs->shadx, fs->shady);
+       }
+
+       BLF_draw(str);
        BLF_disable(BLF_CLIPPING);
+       if (fs->shadow)
+               BLF_disable(BLF_SHADOW);
 }
 
 /* ************** helpers ************************ */