mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
textoverlay: Optimize a bit more
...and add a FIXME for bug #598695 and explain what we should do once Pango supports user fonts.
This commit is contained in:
parent
f63643bd54
commit
eb9acba08f
1 changed files with 15 additions and 5 deletions
|
@ -1245,27 +1245,37 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay,
|
||||||
/* apply transformations */
|
/* apply transformations */
|
||||||
cairo_set_matrix (cr, &cairo_matrix);
|
cairo_set_matrix (cr, &cairo_matrix);
|
||||||
|
|
||||||
/* draw text to cairo path */
|
/* FIXME: We use show_layout everywhere except for the surface
|
||||||
pango_cairo_layout_path (cr, overlay->layout);
|
* because it's really faster and internally does all kinds of
|
||||||
|
* caching. Unfortunately we have to paint to a cairo path for
|
||||||
|
* the outline and this is slow. Once Pango supports user fonts
|
||||||
|
* we should use them, see
|
||||||
|
* https://bugzilla.gnome.org/show_bug.cgi?id=598695
|
||||||
|
*
|
||||||
|
* Idea would the be, to create a cairo user font that
|
||||||
|
* does shadow, outline, text painting in the
|
||||||
|
* render_glyph function.
|
||||||
|
*/
|
||||||
|
|
||||||
/* draw shadow text */
|
/* draw shadow text */
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
|
cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
|
||||||
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
|
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
|
||||||
cairo_fill_preserve (cr);
|
pango_cairo_show_layout (cr, overlay->layout);
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
/* draw outline text */
|
/* draw outline text */
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
|
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
|
||||||
cairo_set_line_width (cr, overlay->outline_offset);
|
cairo_set_line_width (cr, overlay->outline_offset);
|
||||||
cairo_stroke_preserve (cr);
|
pango_cairo_layout_path (cr, overlay->layout);
|
||||||
|
cairo_stroke (cr);
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
cairo_fill (cr);
|
pango_cairo_show_layout (cr, overlay->layout);
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
Loading…
Reference in a new issue