diff options
author | Grigori Goronzy <greg@blackbox> | 2009-07-16 02:17:06 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2009-07-16 02:21:51 +0200 |
commit | ed8ecf731cc77292e613b7cfe13fa64068040c97 (patch) | |
tree | ed51b66d0d4de9159414357b0b23dd1862519c40 /libass/ass_drawing.c | |
parent | 94d41042a9006375eecf5332e9a59657a0c8a492 (diff) | |
download | libass-ed8ecf731cc77292e613b7cfe13fa64068040c97.tar.bz2 libass-ed8ecf731cc77292e613b7cfe13fa64068040c97.tar.xz |
Implement vector clips
Make it possible to use drawings for clipping with \clip and \iclip.
parse_tag was extended to parse drawings in \clip or \iclip tags in case
parsing them as rectangular clips fails. These clip drawings are later
rasterized and used for blending bitmaps, just after bitmaps are
assembled into a list in render_text. Currently, the cache is not
utilized for storing the parsed drawings or blended bitmaps.
Diffstat (limited to 'libass/ass_drawing.c')
-rw-r--r-- | libass/ass_drawing.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index f75bbd9..091ec87 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -106,7 +106,7 @@ static void drawing_prepare(ass_drawing_t *drawing) * \brief Finish a drawing. This only sets the horizontal advance according * to the glyph's bbox at the moment. */ -static void drawing_finish(ass_drawing_t *drawing) +static void drawing_finish(ass_drawing_t *drawing, int raw_mode) { int i, offset; FT_BBox bbox; @@ -127,6 +127,13 @@ static void drawing_finish(ass_drawing_t *drawing) printf("contour %d\n", ol->contours[i]); #endif + ass_msg(drawing->library, MSGL_V, + "Parsed drawing with %d points and %d contours", ol->n_points, + ol->n_contours); + + if (raw_mode) + return; + FT_Outline_Get_CBox(&drawing->glyph->outline, &bbox); drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin); @@ -138,10 +145,6 @@ static void drawing_finish(ass_drawing_t *drawing) drawing->scale_y); for (i = 0; i < ol->n_points; i++) ol->points[i].y += offset; - - ass_msg(drawing->library, MSGL_V, - "Parsed drawing with %d points and %d contours", ol->n_points, - ol->n_contours); } /* @@ -361,7 +364,7 @@ ass_drawing_t *ass_drawing_new(void *fontconfig_priv, ass_font_t *font, ass_drawing_t* drawing; drawing = calloc(1, sizeof(*drawing)); - drawing->text = malloc(DRAWING_INITIAL_SIZE); + drawing->text = calloc(1, DRAWING_INITIAL_SIZE); drawing->size = DRAWING_INITIAL_SIZE; drawing->ftlibrary = lib; @@ -411,7 +414,7 @@ void ass_drawing_hash(ass_drawing_t* drawing) /* * \brief Convert token list to outline. Calls the line and curve evaluators. */ -FT_OutlineGlyph *ass_drawing_parse(ass_drawing_t *drawing) +FT_OutlineGlyph *ass_drawing_parse(ass_drawing_t *drawing, int raw_mode) { int started = 0; ass_drawing_token_t *token; @@ -474,7 +477,7 @@ FT_OutlineGlyph *ass_drawing_parse(ass_drawing_t *drawing) } } - drawing_finish(drawing); + drawing_finish(drawing, raw_mode); drawing_free_tokens(drawing->tokens); return &drawing->glyph; } |