From 88be3075409a2a2ac396f36bc086933a50917298 Mon Sep 17 00:00:00 2001 From: Nathaniel Warner Date: Sat, 12 Dec 2020 11:44:55 -0800 Subject: [PATCH] Gracefully handle pixel format mismatch --- simgear/scene/util/OrthophotoManager.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/simgear/scene/util/OrthophotoManager.cxx b/simgear/scene/util/OrthophotoManager.cxx index 111e8fd6..3a8a8429 100644 --- a/simgear/scene/util/OrthophotoManager.cxx +++ b/simgear/scene/util/OrthophotoManager.cxx @@ -287,6 +287,11 @@ namespace simgear { // Make a deep copy of the orthophoto's image so that we don't modify the original when scaling ImageRef sub_image = new osg::Image(*orthophoto->_texture->getImage(), osg::CopyOp::DEEP_COPY_ALL); + if (sub_image->getPixelFormat() != pixel_format) { + SG_LOG(SG_OSG, SG_ALERT, "Pixel format mismatch. Not creating part of composite orthophoto."); + continue; + } + sub_image->scaleImage(width, height, depth); composite_image->copySubImage(s_offset, t_offset, 0, sub_image);