#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) { update(); cairo->set_source(surface, 0.0, 0.0); cairo->fill(); return true; } }