diff options
-rw-r--r-- | backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp | 1 | ||||
-rw-r--r-- | backends/cloud/googledrive/googledrivestorage.cpp | 1 | ||||
-rw-r--r-- | backends/networking/curl/cloudicon.cpp | 46 | ||||
-rw-r--r-- | backends/networking/curl/cloudicon.h | 8 |
4 files changed, 20 insertions, 36 deletions
diff --git a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp index 3c31ddba73..0b90ec6d2c 100644 --- a/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp +++ b/backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp @@ -27,6 +27,7 @@ #include "backends/networking/curl/curljsonrequest.h" #include "backends/networking/curl/networkreadstream.h" #include "common/json.h" +#include "common/debug.h" namespace Cloud { namespace Dropbox { diff --git a/backends/cloud/googledrive/googledrivestorage.cpp b/backends/cloud/googledrive/googledrivestorage.cpp index f4a6fba10f..ec4c84400c 100644 --- a/backends/cloud/googledrive/googledrivestorage.cpp +++ b/backends/cloud/googledrive/googledrivestorage.cpp @@ -33,6 +33,7 @@ #include "common/config-manager.h" #include "common/debug.h" #include "common/json.h" +#include "common/debug.h" #include <curl/curl.h> #ifdef ENABLE_RELEASE diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp index 3ae6fd225e..9aa08af9fb 100644 --- a/backends/networking/curl/cloudicon.cpp +++ b/backends/networking/curl/cloudicon.cpp @@ -39,7 +39,11 @@ CloudIcon::CloudIcon(): initIcons(); } -CloudIcon::~CloudIcon() {} +CloudIcon::~CloudIcon() { + _icon.free(); + _disabledIcon.free(); + _alphaIcon.free(); +} bool CloudIcon::draw() { bool stop = false; @@ -48,7 +52,6 @@ bool CloudIcon::draw() { if (CloudMan.isWorking() || _disabledFrames > 0) { if (g_system) { if (!_wasVisible) { - g_system->clearOSD(); _wasVisible = true; } --_disabledFrames; @@ -81,13 +84,11 @@ bool CloudIcon::draw() { } if (g_system) { - Graphics::TransparentSurface *surface = &_icon; - makeAlphaIcon((_showingDisabled ? _disabledIcon : _icon), _currentAlpha); - if (_alphaIcon.getPixels()) - surface = &_alphaIcon; - if (surface && surface->getPixels()) { - int x = g_system->getOverlayWidth() - surface->w - 10, y = 10; - g_system->copyRectToOSD(surface->getPixels(), surface->pitch, x, y, surface->w, surface->h); + if (!stop) { + makeAlphaIcon((_showingDisabled ? _disabledIcon : _icon), _currentAlpha); + g_system->displayActivityIconOnOSD(&_alphaIcon); + } else { + g_system->displayActivityIconOnOSD(nullptr); } } @@ -112,36 +113,17 @@ void CloudIcon::initIcons() { _iconsInited = true; } -void CloudIcon::loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32 size) { +void CloudIcon::loadIcon(Graphics::Surface &icon, byte *data, uint32 size) { Image::PNGDecoder decoder; Common::MemoryReadStream stream(data, size); if (!decoder.loadStream(stream)) error("CloudIcon::loadIcon: error decoding PNG"); - Graphics::TransparentSurface *s = new Graphics::TransparentSurface(*decoder.getSurface(), true); - if (s) { - Graphics::PixelFormat f = g_system->getOSDFormat(); - if (f != s->format) { - // 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 - warning("CloudIcon::loadIcon: failed converting TransparentSurface"); - delete s2; - } else { - icon.copyFrom(*s); - } - delete s; - } else { - warning("CloudIcon::loadIcon: failed reading TransparentSurface from PNGDecoder"); - } + const Graphics::Surface *s = decoder.getSurface(); + return icon.copyFrom(*s); } -void CloudIcon::makeAlphaIcon(Graphics::TransparentSurface &icon, float alpha) { +void CloudIcon::makeAlphaIcon(Graphics::Surface &icon, float alpha) { _alphaIcon.copyFrom(icon); byte *pixels = (byte *)_alphaIcon.getPixels(); diff --git a/backends/networking/curl/cloudicon.h b/backends/networking/curl/cloudicon.h index 316cb67370..d6ea60bd51 100644 --- a/backends/networking/curl/cloudicon.h +++ b/backends/networking/curl/cloudicon.h @@ -23,7 +23,7 @@ #ifndef BACKENDS_NETWORKING_CURL_CLOUDICON_H #define BACKENDS_NETWORKING_CURL_CLOUDICON_H -#include "graphics/transparent_surface.h" +#include "graphics/surface.h" namespace Networking { @@ -31,14 +31,14 @@ class CloudIcon { static const float ALPHA_STEP, ALPHA_MAX, ALPHA_MIN; bool _wasVisible, _iconsInited, _showingDisabled; - Graphics::TransparentSurface _icon, _disabledIcon, _alphaIcon; + Graphics::Surface _icon, _disabledIcon, _alphaIcon; float _currentAlpha; bool _alphaRising; int _disabledFrames; void initIcons(); - void loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32 size); - void makeAlphaIcon(Graphics::TransparentSurface &icon, float alpha); + void loadIcon(Graphics::Surface &icon, byte *data, uint32 size); + void makeAlphaIcon(Graphics::Surface &icon, float alpha); public: CloudIcon(); |