+
+ /* Copy pixbuf data for callback */
+ struct _LoadTileData *data = g_new0(struct _LoadTileData, 1);
+ data->sat = sat;
+ data->tile = tile;
+ data->pixels = gdk_pixbuf_get_pixels(pixbuf);
+ data->alpha = gdk_pixbuf_get_has_alpha(pixbuf);
+ data->width = gdk_pixbuf_get_width(pixbuf);
+ data->height = gdk_pixbuf_get_height(pixbuf);
+ data->pixels = g_memdup(data->pixels,
+ data->width * data->height * (data->alpha ? 4 : 3));
+ g_object_unref(pixbuf);
+
+ /* Draw a border */
+ //gint border = 10;
+ //gint stride = gdk_pixbuf_get_rowstride(pixbuf);
+ //for (int i = 0; i < border; i++) {
+ // memset(&pixels[( i)*stride], 0xff, stride);
+ // memset(&pixels[(height-i)*stride], 0xff, stride);
+ //}
+ //for (int i = 0; i < height; i++) {
+ // memset(&pixels[(i*stride)], 0xff, border*4);
+ // memset(&pixels[(i*stride)+((width-border)*4)], 0xff, border*4);
+ //}
+
+ /* Load the GL texture from the main thread */
+ g_idle_add_full(G_PRIORITY_LOW, _load_tile_cb, data, NULL);
+ g_debug("GritsPluginSat: _load_tile end %p", g_thread_self());