summaryrefslogtreecommitdiff
path: root/src/lib/image.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-06-07 21:27:40 +0100
committerCarl Hetherington <cth@carlh.net>2017-06-07 21:27:40 +0100
commit2d9f569c146b391159f362c854457ce1facac1e8 (patch)
treea89e9932ed139854210341b13bdd9903cae07981 /src/lib/image.cc
parent3458d0ec34f08a8eeef9b158f26a476a18548353 (diff)
Fix crash when alpha-blending subtitles onto YUV420 images.
Diffstat (limited to 'src/lib/image.cc')
-rw-r--r--src/lib/image.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index b82cc6072..03a4d96b4 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -1035,3 +1035,13 @@ Image::fade (float f)
throw PixelFormatError ("fade()", _pixel_format);
}
}
+
+shared_ptr<Image>
+Image::ensure_aligned (shared_ptr<Image> image)
+{
+ if (image->aligned()) {
+ return image;
+ }
+
+ return shared_ptr<Image> (new Image (image, true));
+}