diff options
author | Grigori Goronzy <greg@blackbox> | 2009-07-11 02:18:51 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2009-07-11 02:22:18 +0200 |
commit | 2c412cdab94a7bb27c5a1e04ab902295215de888 (patch) | |
tree | c1372ebf5e6473b287e152a40c88587f3470d237 /libass/ass_bitmap.c | |
parent | 613a22ab9b96453c10de6d75b43067652ad6d7db (diff) | |
download | libass-2c412cdab94a7bb27c5a1e04ab902295215de888.tar.bz2 libass-2c412cdab94a7bb27c5a1e04ab902295215de888.tar.xz |
Message callback funtionality
Introduce functionality for providing a message callback that is used
for passing messages to the controlling application instead of simply
printing them to standard output. The function pointer to the callback
is stored in the ass_library_t instance. ass_msg needs access to it, so
in many places the library instance needs to be passed around now.
The default behavior is the old one: messages of MSGL_INFO or lower
are printed to the standard output, prefixed with "[ass]".
Diffstat (limited to 'libass/ass_bitmap.c')
-rw-r--r-- | libass/ass_bitmap.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c index a72caadb..c8cd8be7 100644 --- a/libass/ass_bitmap.c +++ b/libass/ass_bitmap.c @@ -165,7 +165,7 @@ static bitmap_t *copy_bitmap(const bitmap_t *src) return dst; } -static int check_glyph_area(FT_Glyph glyph) +static int check_glyph_area(ass_library_t *library, FT_Glyph glyph) { FT_BBox bbox; long long dx, dy; @@ -173,14 +173,15 @@ static int check_glyph_area(FT_Glyph glyph) dx = bbox.xMax - bbox.xMin; dy = bbox.yMax - bbox.yMin; if (dx * dy > 8000000) { - ass_msg(MSGL_WARN, "Glyph bounding box too large: %dx%dpx", + ass_msg(library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx", (int) dx, (int) dy); return 1; } else return 0; } -static bitmap_t *glyph_to_bitmap_internal(FT_Glyph glyph, int bord) +static bitmap_t *glyph_to_bitmap_internal(ass_library_t *library, + FT_Glyph glyph, int bord) { FT_BitmapGlyph bg; FT_Bitmap *bit; @@ -191,11 +192,11 @@ static bitmap_t *glyph_to_bitmap_internal(FT_Glyph glyph, int bord) int i; int error; - if (check_glyph_area(glyph)) + if (check_glyph_area(library, glyph)) return 0; error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 0); if (error) { - ass_msg(MSGL_WARN, "FT_Glyph_To_Bitmap error %d", + ass_msg(library, MSGL_WARN, "FT_Glyph_To_Bitmap error %d", error); return 0; } @@ -203,7 +204,7 @@ static bitmap_t *glyph_to_bitmap_internal(FT_Glyph glyph, int bord) bg = (FT_BitmapGlyph) glyph; bit = &(bg->bitmap); if (bit->pixel_mode != FT_PIXEL_MODE_GRAY) { - ass_msg(MSGL_WARN, "Unsupported pixel mode: %d", + ass_msg(library, MSGL_WARN, "Unsupported pixel mode: %d", (int) (bit->pixel_mode)); FT_Done_Glyph(glyph); return 0; @@ -471,7 +472,7 @@ static void be_blur(unsigned char *buf, int w, int h) } } -int glyph_to_bitmap(ass_synth_priv_t *priv_blur, +int glyph_to_bitmap(ass_library_t *library, ass_synth_priv_t *priv_blur, FT_Glyph glyph, FT_Glyph outline_glyph, bitmap_t **bm_g, bitmap_t **bm_o, bitmap_t **bm_s, int be, double blur_radius, FT_Vector shadow_offset) @@ -487,12 +488,12 @@ int glyph_to_bitmap(ass_synth_priv_t *priv_blur, *bm_g = *bm_o = *bm_s = 0; if (glyph) - *bm_g = glyph_to_bitmap_internal(glyph, bord); + *bm_g = glyph_to_bitmap_internal(library, glyph, bord); if (!*bm_g) return 1; if (outline_glyph) { - *bm_o = glyph_to_bitmap_internal(outline_glyph, bord); + *bm_o = glyph_to_bitmap_internal(library, outline_glyph, bord); if (!*bm_o) { ass_free_bitmap(*bm_g); return 1; |