diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-25 09:41:36 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-25 09:41:36 +0000 |
| commit | ee77b3cf5f59f775e75e628aa28e8f2f9f941530 (patch) | |
| tree | bbf9ab4ef1f0f633591889cbbd6b7b65de8f5a57 /src/lib/render_subtitles.cc | |
| parent | e6f28e7cda23c1ba3c49cc1bf2dc1491c2f87160 (diff) | |
It builds.
Diffstat (limited to 'src/lib/render_subtitles.cc')
| -rw-r--r-- | src/lib/render_subtitles.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/render_subtitles.cc b/src/lib/render_subtitles.cc index c18cb4272..5364b8dfe 100644 --- a/src/lib/render_subtitles.cc +++ b/src/lib/render_subtitles.cc @@ -28,6 +28,7 @@ using std::cout; using std::string; using std::min; using std::max; +using std::pair; using boost::shared_ptr; using boost::optional; @@ -46,12 +47,11 @@ calculate_position (dcp::VAlign v_align, double v_position, int target_height, i return 0; } -void -render_subtitles (list<dcp::SubtitleString> subtitles, dcp::Size target, shared_ptr<Image>& image, Position<int>& position) +PositionImage +render_subtitles (list<dcp::SubtitleString> subtitles, dcp::Size target) { if (subtitles.empty ()) { - image.reset (); - return; + return PositionImage (); } /* Estimate height that the subtitle image needs to be */ @@ -68,7 +68,7 @@ render_subtitles (list<dcp::SubtitleString> subtitles, dcp::Size target, shared_ top = top.get() - 32; bottom = bottom.get() + 32; - image.reset (new Image (PIX_FMT_RGBA, dcp::Size (target.width, bottom.get() - top.get ()), false)); + shared_ptr<Image> image (new Image (PIX_FMT_RGBA, dcp::Size (target.width, bottom.get() - top.get ()), false)); image->make_black (); Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create ( @@ -146,5 +146,7 @@ render_subtitles (list<dcp::SubtitleString> subtitles, dcp::Size target, shared_ context->stroke (); } } + + return PositionImage (image, Position<int> (0, top.get ())); } |
