]> granicus.if.org Git - libass/commitdiff
opaque box: do not subtract glyph from border
authorGrigori Goronzy <greg@blackbox>
Tue, 1 Sep 2009 00:39:51 +0000 (02:39 +0200)
committerGrigori Goronzy <greg@blackbox>
Tue, 1 Sep 2009 00:39:51 +0000 (02:39 +0200)
Similar to VSFilter, do not subtract the glyph bitmap from the border
bitmap when BorderStyle 3 is used.

libass/ass_bitmap.c
libass/ass_bitmap.h
libass/ass_render.c

index e2018ce1b3b5c6bc1be8bcd2db0c497623ccad41..1ae2d7c3e7a23c16ecd34fe1d42022843ed3e6e1 100644 (file)
@@ -475,7 +475,8 @@ static void be_blur(unsigned char *buf, int w, int h)
 int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur,
                     FT_Glyph glyph, FT_Glyph outline_glyph,
                     Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
-                    int be, double blur_radius, FT_Vector shadow_offset)
+                    int be, double blur_radius, FT_Vector shadow_offset,
+                    int border_style)
 {
     blur_radius *= 2;
     int bbord = be > 0 ? sqrt(2 * be) : 0;
@@ -527,7 +528,9 @@ int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur,
                            priv_blur->g_w);
     }
 
-    if (*bm_o)
+    if (*bm_o && border_style == 3)
+        *bm_s = copy_bitmap(*bm_o);
+    else if (*bm_o)
         *bm_s = fix_outline_and_shadow(*bm_g, *bm_o);
     else
         *bm_s = copy_bitmap(*bm_g);
index 3b63cee071091c7c121415998351e692448cacd2..338db011937871e65795a45c296eeff011b0f323 100644 (file)
@@ -49,7 +49,8 @@ typedef struct {
 int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur,
                     FT_Glyph glyph, FT_Glyph outline_glyph,
                     Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
-                    int be, double blur_radius, FT_Vector shadow_offset);
+                    int be, double blur_radius, FT_Vector shadow_offset,
+                    int border_style);
 
 void ass_free_bitmap(Bitmap *bm);
 
index f67cba64efe426826915ee9613074cc793f51d76..514dfbe0b094b17d7149d1529d75673bb4359617 100644 (file)
@@ -2161,7 +2161,8 @@ get_bitmap_glyph(ASS_Renderer *render_priv, GlyphInfo *info)
                                     &info->bm, &info->bm_o,
                                     &info->bm_s, info->be,
                                     info->blur * render_priv->border_scale,
-                                    info->hash_key.shadow_offset);
+                                    info->hash_key.shadow_offset,
+                                    info->hash_key.border_style);
             if (error)
                 info->symbol = 0;