我有一些 const unsigned char * 格式的原始数据,这是一张图片。
我通过调用函数gdk_pixbuf_new_from_data创建了GdkPixbuf。但是,当我检查新GdkPixbuf的内存时,它根本就没有创建。
virtual void onPaint(Window *wini, const unsigned char *bitmap_in, const Rect &bitmap_rect,
size_t num_copy_rects, const Rect *copy_rects,
int dx, int dy, const Rect &scroll_rect)
{
GdkPixbuf* pbuf = gdk_pixbuf_new_from_data((const guchar*)bitmap_in,GDK_COLORSPACE_RGB,FALSE,8,bitmap_rect.width(),bitmap_rect.height(),GST_ROUND_UP_4(bitmap_rect.width() * 3),NULL,NULL);
static int call_count = 0;
string fname = "/tmp/testout/file" + toString(call_count++) + ".png";
bool state = gdk_pixbuf_save(pbuf,fname.c_str(),"png",NULL);
}