aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/curl
diff options
context:
space:
mode:
authorThierry Crozat2016-09-05 21:59:34 +0100
committerThierry Crozat2016-09-05 21:59:34 +0100
commitd853240eeea01cae0ae95be85a467b34054eca13 (patch)
tree2c08e31aafccf48840deac3d55818ab910063a8b /backends/networking/curl
parentbd66e005c23b2bf26c7c78a1ed1f26e911b6e6c0 (diff)
downloadscummvm-rg350-d853240eeea01cae0ae95be85a467b34054eca13.tar.gz
scummvm-rg350-d853240eeea01cae0ae95be85a467b34054eca13.tar.bz2
scummvm-rg350-d853240eeea01cae0ae95be85a467b34054eca13.zip
CLOUD: Do not error out when loading icon if OSD format is not 2 or 4 Bpp
Graphics::TransparentSurface::convertTo() errors out when the destination format is not 2 or 4 Bpp. But in the case of the cloud icon we can recover from it. So just print a warning and don't close the application.
Diffstat (limited to 'backends/networking/curl')
-rw-r--r--backends/networking/curl/cloudicon.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp
index fd587f9b5d..3ae6fd225e 100644
--- a/backends/networking/curl/cloudicon.cpp
+++ b/backends/networking/curl/cloudicon.cpp
@@ -122,7 +122,11 @@ void CloudIcon::loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32
if (s) {
Graphics::PixelFormat f = g_system->getOSDFormat();
if (f != s->format) {
- Graphics::TransparentSurface *s2 = s->convertTo(f);
+ // Graphics::TransparentSurface::convertTo(f) errors out if the format is not 2Bpp or 4Bpp.
+ // We don't need to error out as we can recover from it. So check the format before calling convertTo(f);
+ Graphics::TransparentSurface *s2 = nullptr;
+ if (f.bytesPerPixel == 2 || f.bytesPerPixel == 4)
+ s2 = s->convertTo(f);
if (s2)
icon.copyFrom(*s2);
else