aboutsummaryrefslogtreecommitdiff
path: root/src/Gif.cpp
blob: 0015f50e86d5e9433eb410c5c34489a3103444f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "../include/Gif.hpp"

namespace dchat
{
    SfmlGif::SfmlGif(StringView fileContent) : Gif(fileContent)
    {

    }


    bool SfmlGif::createTexture()
    {
        Vec2u size = getSize();
        if(!texture.create(size.x, size.y))
        {
            fprintf(stderr, "Failed to create texture for gif!\n");
            return false;
        }

        texture.setSmooth(true);
        texture.generateMipmap();
        return true;
    }

    void SfmlGif::updateTexture(void *textureData)
    {
        texture.update((const sf::Uint8*)textureData);
    }
}