aboutsummaryrefslogtreecommitdiff
path: root/src/DynamicImage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DynamicImage.cpp')
-rw-r--r--src/DynamicImage.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/DynamicImage.cpp b/src/DynamicImage.cpp
index 8759497..0a31d36 100644
--- a/src/DynamicImage.cpp
+++ b/src/DynamicImage.cpp
@@ -1,6 +1,7 @@
#include "../include/DynamicImage.hpp"
#include "../include/GlobalCache.hpp"
#include "../include/GtkGif.hpp"
+#include "../include/GtkScaledImage.hpp"
namespace dchat
{
@@ -18,8 +19,23 @@ namespace dchat
auto result = getGlobalCache().getContentByUrl(url, downloadLimitBytes);
if(result.type == ContentByUrlResult::Type::CACHED && result.gif)
{
- GtkGif *gif = (GtkGif*)result.gif;
- gif->draw(cairo, alloc.get_width(), alloc.get_height());
+ switch(result.cachedType)
+ {
+ case ContentByUrlResult::CachedType::STATIC_IMAGE:
+ {
+ GtkScaledImage *staticImage = (GtkScaledImage*)result.staticImage;
+ staticImage->draw(cairo, alloc.get_width(), alloc.get_height(), true);
+ break;
+ }
+ case ContentByUrlResult::CachedType::GIF:
+ {
+ GtkGif *gif = (GtkGif*)result.gif;
+ gif->draw(cairo, alloc.get_width(), alloc.get_height(), true);
+ break;
+ }
+ default:
+ break;
+ }
}
}
queue_draw();