diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-11-20 10:12:28 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-11-20 10:12:31 +0100 |
commit | d6a8a286dc861026a0b1a858aa093fc432e6b9de (patch) | |
tree | cce61e9caf7740824c2eb4138a92b8fd13629850 /src/DynamicImage.cpp | |
parent | 64ab3253562be80e726b3d69e4c3e556b055c965 (diff) |
Add static image
Diffstat (limited to 'src/DynamicImage.cpp')
-rw-r--r-- | src/DynamicImage.cpp | 20 |
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(); |