Gracefully handle pixel format mismatch

This commit is contained in:
Nathaniel Warner 2020-12-12 11:44:55 -08:00
parent 4c0f6d7638
commit 88be307540

View File

@ -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 // 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); 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); sub_image->scaleImage(width, height, depth);
composite_image->copySubImage(s_offset, t_offset, 0, sub_image); composite_image->copySubImage(s_offset, t_offset, 0, sub_image);