Fix DCP building with subs.
authorCarl Hetherington <cth@carlh.net>
Thu, 26 Dec 2013 20:01:43 +0000 (20:01 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 26 Dec 2013 20:01:43 +0000 (20:01 +0000)
src/lib/image.cc

index 5b5491101b7835b3453a935e9c61fdbc55cf64f2..e5f626c24762bbb2e57be8e1bd06a1cada3b9efc 100644 (file)
@@ -376,11 +376,18 @@ Image::make_black ()
 void
 Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
 {
-       /* Only implemented for RGBA onto BGRA so far */
-       assert (_pixel_format == PIX_FMT_BGRA && other->pixel_format() == PIX_FMT_RGBA);
-
-       int const this_bpp = 4;
-       int const other_bpp = 4;
+       int this_bpp = 0;
+       int other_bpp = 0;
+
+       if (_pixel_format == PIX_FMT_BGRA && other->pixel_format() == PIX_FMT_RGBA) {
+               this_bpp = 4;
+               other_bpp = 4;
+       } else if (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGBA) {
+               this_bpp = 3;
+               other_bpp = 4;
+       } else {
+               assert (false);
+       }
 
        int start_tx = position.x;
        int start_ox = 0;