blob: 1da48a8a2b0dfd25d72518bfd3a683a860903826 (
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
30
31
|
#include "../include/GtkGif.hpp"
namespace dchat
{
GtkGif::GtkGif(StringView fileContent) :
Gif(fileContent)
{
//signal_draw().connect(sigc::mem_fun(*this, &GtkGif::updateContent));
set_app_paintable(true);
}
bool GtkGif::createTexture(int width, int height)
{
surface = Cairo::ImageSurface::create(Cairo::Format::FORMAT_ARGB32, width, height);
return true;
}
void GtkGif::updateTexture(void *textureData)
{
unsigned char *pixels = surface->get_data();
memcpy(pixels, textureData, surface->get_stride() * surface->get_height());
}
bool GtkGif::on_draw(const Cairo::RefPtr<Cairo::Context> &cairo)
{
update();
cairo->set_source(surface, 0.0, 0.0);
cairo->fill();
return true;
}
}
|