Add another believed-correct subtitle timing fix.
[dcpomatic.git] / src / lib / render_text.cc
index d4d827a6b23c1b629408a007a4401bb9a523cf00..7bb7d6b456990d2b12f21f1a4ec343d8534290d2 100644 (file)
@@ -34,9 +34,6 @@ DCPOMATIC_DISABLE_WARNINGS
 #include <pangomm.h>
 DCPOMATIC_ENABLE_WARNINGS
 #include <pango/pangocairo.h>
-#ifndef DCPOMATIC_HAVE_SHOW_IN_CAIRO_CONTEXT
-#include <pango/pangocairo.h>
-#endif
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 
@@ -80,11 +77,7 @@ marked_up (list<StringText> subtitles, int target_height, float fade_factor)
                /* Between 1-65535 inclusive, apparently... */
                out += "alpha=\"" + dcp::raw_convert<string>(int(floor(fade_factor * 65534)) + 1) + "\" ";
                out += "color=\"#" + i.colour().to_rgb_string() + "\">";
-
-               string t = i.text();
-               replace_all(t, "&", "&amp;");
-               out += t;
-
+               out += i.text();
                out += "</span>";
        }
 
@@ -112,8 +105,7 @@ create_image (dcp::Size size)
 static Cairo::RefPtr<Cairo::ImageSurface>
 create_surface (shared_ptr<Image> image)
 {
-#ifdef DCPOMATIC_HAVE_FORMAT_STRIDE_FOR_WIDTH
-       auto surface = Cairo::ImageSurface::create (
+       return Cairo::ImageSurface::create (
                image->data()[0],
                Cairo::FORMAT_ARGB32,
                image->size().width,
@@ -121,20 +113,6 @@ create_surface (shared_ptr<Image> image)
                /* Cairo ARGB32 means first byte blue, second byte green, third byte red, fourth byte alpha */
                Cairo::ImageSurface::format_stride_for_width (Cairo::FORMAT_ARGB32, image->size().width)
                );
-#else
-       /* Centos 5 does not have Cairo::ImageSurface::format_stride_for_width, so just use width * 4
-          which I hope is safe (if slow)
-       */
-       auto surface = Cairo::ImageSurface::create (
-               image->data()[0],
-               Cairo::FORMAT_ARGB32,
-               image->size().width,
-               image->size().height,
-               image->size().width * 4
-               );
-#endif
-
-       return surface;
 }