aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp11
-rw-r--r--src/Channel.cpp2
-rw-r--r--src/Gif.cpp11
3 files changed, 11 insertions, 13 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 1c3261b..df97174 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -134,7 +134,7 @@ namespace dchat
}
catch(std::exception &e)
{
-
+ fprintf(stderr, "Failed to load image %s, reason: %s\n", filepath.string().c_str(), e.what());
}
return { (sf::Texture*)nullptr, ImageByUrlResult::Type::FAILED_DOWNLOAD };
}
@@ -162,14 +162,9 @@ namespace dchat
imageDownloadMutex.lock();
imageUrlCache[it->url] = imageByUrlResult;
imageDownloadMutex.unlock();
- switch(imageByUrlResult.type)
+ if(imageByUrlResult.type == ImageByUrlResult::Type::CACHED)
{
- case ImageByUrlResult::Type::CACHED:
- printf("Downloaded image from url: %s\n", it->url.c_str());
- break;
- case ImageByUrlResult::Type::FAILED_DOWNLOAD:
- printf("Failed to download and load image from url: %s\n", it->url.c_str());
- break;
+ printf("Download %s from url: %s\n", imageByUrlResult.isGif ? "gif" : "image", it->url.c_str());
}
}
it = imageDownloadProcesses.erase(it);
diff --git a/src/Channel.cpp b/src/Channel.cpp
index a76a2c6..ce8c76c 100644
--- a/src/Channel.cpp
+++ b/src/Channel.cpp
@@ -45,7 +45,7 @@ namespace dchat
}
{
- Message *message = new Message(&systemUser, u8"[emoji](https://discordemoji.com/assets/emoji/SlowbroDumb.png)");
+ Message *message = new Message(&systemUser, u8"[emoji](https://discordemoji.com/assets/emoji/PepeDab.gif)");
messageBoard.addMessage(message);
}
diff --git a/src/Gif.cpp b/src/Gif.cpp
index a9e7850..4d1295c 100644
--- a/src/Gif.cpp
+++ b/src/Gif.cpp
@@ -147,16 +147,19 @@ namespace dchat
u32 startFrame = currentFrame;
while(true)
{
- int i = currentFrame % gif.frame_count;
+ u32 i = currentFrame % gif.frame_count;
gif_result code = gif_decode_frame(&gif, i);
if(code != GIF_OK)
printf("Warning: gif_decode_frame: %s\n", gifResultToString(code));
gif_frame &frame = gif.frames[i];
// frame_delay is in centiseconds
- double frameDelay = (double)frame.frame_delay;
- if(timeElapsedCs >= frameDelay)
- timeElapsedCs -= frameDelay;
+ unsigned int frameDelay = frame.frame_delay;
+ if(frameDelay == 0)
+ frameDelay = 7;
+ double fFrameDelay = (double)frameDelay;
+ if(timeElapsedCs >= fFrameDelay)
+ timeElapsedCs -= fFrameDelay;
else
break;