aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-31 18:11:35 +0100
committerdec05eba <dec05eba@protonmail.com>2018-10-31 18:11:36 +0100
commit07c9e3d393db4b4d59262f7d9898be169ac2f927 (patch)
tree2623fbfd1c1614c2de575437cb89a787e93d8c1d /src
parenta5e2adedf38f84a8be5e8d844e02991d3bbfecca (diff)
Make generic
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp7
-rw-r--r--src/Gif.cpp13
2 files changed, 15 insertions, 5 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 712a716..8657371 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -286,6 +286,8 @@ namespace dchat
checkContentAccessTimeThread = thread([this]
{
+ // TODO: Add this back
+ #if 0
while(alive)
{
this_thread::sleep_for(chrono::milliseconds(500));
@@ -323,6 +325,7 @@ namespace dchat
++it;
}
}
+ #endif
});
}
@@ -331,7 +334,8 @@ namespace dchat
alive = false;
downloadWaitThread.join();
checkContentAccessTimeThread.join();
-
+ // TODO: Add this back
+ #if 0
for(auto &it : contentUrlCache)
{
if(!it.second.textureFilePath)
@@ -362,6 +366,7 @@ namespace dchat
break;
}
}
+ #endif
}
static void createFileIgnoreError(const boost::filesystem::path &path)
diff --git a/src/Gif.cpp b/src/Gif.cpp
index 2391872..983030c 100644
--- a/src/Gif.cpp
+++ b/src/Gif.cpp
@@ -81,7 +81,8 @@ namespace dchat
Gif::Gif(StringView _fileContent) :
fileContent(move(_fileContent)),
currentFrame(0),
- timeElapsedCs(0.0)
+ timeElapsedCs(0.0),
+ created(false)
{
try
{
@@ -120,9 +121,6 @@ namespace dchat
}
}
while(code != GIF_OK);
-
- if(!createTexture(gif.width, gif.height))
- throw GifLoadException("Failed to create texture for gif");
}
Gif::~Gif()
@@ -138,6 +136,13 @@ namespace dchat
void Gif::update()
{
+ if(!created)
+ {
+ created = true;
+ if(!createTexture(gif.width, gif.height))
+ throw GifLoadException("Failed to create texture for gif");
+ }
+
double timeElapsedMilli = (double)frameTimer.getElapsedTimeMillis();
// If gif is not redrawn for a while, then we reset timer (gif is paused). This happens when gif is not visible and then appears visible
// (because it's visible in window). The reason this is done is to prevent too much time between rendering gif frames, as processing a gif