4 * Copyright (C) 2008 - 2012 The Geeqie Team
7 * Author: Vladimir Nadvornik
9 * This software is released under the GNU General Public License (GNU GPL).
10 * Please read the included file COPYING for more information.
11 * This software comes with no warranty of any kind, use at your own risk!
20 #include "pixbuf-renderer.h"
21 #include "renderer-clutter.h"
31 #define COGL_ENABLE_EXPERIMENTAL_API
33 #include <clutter/clutter.h>
35 #include <clutter-gtk/clutter-gtk.h>
43 #include "pixbuf_util.h"
47 EXIF_ORIENTATION_UNKNOWN = 0,
48 EXIF_ORIENTATION_TOP_LEFT = 1,
49 EXIF_ORIENTATION_TOP_RIGHT = 2,
50 EXIF_ORIENTATION_BOTTOM_RIGHT = 3,
51 EXIF_ORIENTATION_BOTTOM_LEFT = 4,
52 EXIF_ORIENTATION_LEFT_TOP = 5,
53 EXIF_ORIENTATION_RIGHT_TOP = 6,
54 EXIF_ORIENTATION_RIGHT_BOTTOM = 7,
55 EXIF_ORIENTATION_LEFT_BOTTOM = 8
56 } ExifOrientationType;
59 #define GET_RIGHT_PIXBUF_OFFSET(rc) \
60 (( (rc->stereo_mode & PR_STEREO_RIGHT) && !(rc->stereo_mode & PR_STEREO_SWAP)) || \
61 (!(rc->stereo_mode & PR_STEREO_RIGHT) && (rc->stereo_mode & PR_STEREO_SWAP)) ? \
62 rc->pr->stereo_pixbuf_offset_right : rc->pr->stereo_pixbuf_offset_left )
64 #define GET_LEFT_PIXBUF_OFFSET(rc) \
65 ((!(rc->stereo_mode & PR_STEREO_RIGHT) && !(rc->stereo_mode & PR_STEREO_SWAP)) || \
66 ( (rc->stereo_mode & PR_STEREO_RIGHT) && (rc->stereo_mode & PR_STEREO_SWAP)) ? \
67 rc->pr->stereo_pixbuf_offset_right : rc->pr->stereo_pixbuf_offset_left )
70 typedef struct _OverlayData OverlayData;
81 OverlayRendererFlags flags;
84 typedef struct _RendererClutter RendererClutter;
86 struct _RendererClutter
97 GList *pending_updates;
102 GtkWidget *widget; /* widget and stage may be shared with other renderers */
104 ClutterActor *texture;
107 gboolean clut_updated;
108 gint64 last_pixbuf_change;
111 typedef struct _RendererClutterAreaParam RendererClutterAreaParam;
112 struct _RendererClutterAreaParam {
122 static void rc_set_shader(CoglHandle material)
127 shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
128 cogl_shader_source (shader,
129 "vec3 checker(vec2 texc, vec3 color0, vec3 color1) \n"
131 " if (mod(int(floor(texc.x) + floor(texc.y)), 2) == 0) \n"
137 "uniform sampler2D tex; \n"
138 "uniform sampler3D clut; \n"
139 "uniform float scale; \n"
140 "uniform float offset; \n"
144 " vec3 bg = checker(gl_FragCoord.xy / 16, vec3(0.6, 0.6, 0.6), vec3(0.4, 0.4, 0.4)); \n"
145 " vec4 img4 = texture2D(tex, gl_TexCoord[0].xy); \n"
146 " vec3 img3 = img4.rgb; \n"
147 " img3 = img3 * scale + offset; \n"
148 " img3 = texture3D(clut, img3); \n"
150 " gl_FragColor = vec4(img3 * img4.a + bg * (1.0 - img4.a), 1.0); \n"
153 cogl_shader_compile(shader);
154 gchar *err = cogl_shader_get_info_log(shader);
158 program = cogl_create_program ();
159 cogl_program_attach_shader (program, shader);
160 cogl_handle_unref (shader);
161 cogl_program_link (program);
163 uniform_no = cogl_program_get_uniform_location (program, "tex");
164 cogl_program_set_uniform_1i (program, uniform_no, 0);
166 uniform_no = cogl_program_get_uniform_location (program, "clut");
167 cogl_program_set_uniform_1i (program, uniform_no, 1);
169 uniform_no = cogl_program_get_uniform_location (program, "scale");
170 cogl_program_set_uniform_1f (program, uniform_no, (double) (CLUT_SIZE - 1) / CLUT_SIZE);
172 uniform_no = cogl_program_get_uniform_location (program, "offset");
173 cogl_program_set_uniform_1f (program, uniform_no, 1.0 / (2 * CLUT_SIZE));
175 cogl_material_set_user_program (material, program);
176 cogl_handle_unref (program);
180 static void rc_prepare_post_process_lut(RendererClutter *rc)
182 PixbufRenderer *pr = rc->pr;
183 static guchar clut[CLUT_SIZE * CLUT_SIZE * CLUT_SIZE * 3];
185 GdkPixbuf *tmp_pixbuf;
189 DEBUG_0("%s clut start", get_exec_time());
191 for (r = 0; r < CLUT_SIZE; r++)
193 for (g = 0; g < CLUT_SIZE; g++)
195 for (b = 0; b < CLUT_SIZE; b++)
197 guchar *ptr = clut + ((b * CLUT_SIZE + g) * CLUT_SIZE + r) * 3;
198 ptr[0] = floor ((double) r / (CLUT_SIZE - 1) * 255.0 + 0.5);
199 ptr[1] = floor ((double) g / (CLUT_SIZE - 1) * 255.0 + 0.5);
200 ptr[2] = floor ((double) b / (CLUT_SIZE - 1) * 255.0 + 0.5);
204 tmp_pixbuf = gdk_pixbuf_new_from_data(clut, GDK_COLORSPACE_RGB, FALSE, 8,
205 CLUT_SIZE * CLUT_SIZE,
207 CLUT_SIZE * CLUT_SIZE * 3,
209 if (pr->func_post_process)
211 pr->func_post_process(pr, &tmp_pixbuf, 0, 0, CLUT_SIZE * CLUT_SIZE, CLUT_SIZE, pr->post_process_user_data);
213 g_object_unref(tmp_pixbuf);
215 DEBUG_0("%s clut upload start", get_exec_time());
217 tex3d = cogl_texture_3d_new_from_data(CLUT_SIZE, CLUT_SIZE, CLUT_SIZE,
219 COGL_PIXEL_FORMAT_RGB_888,
220 COGL_PIXEL_FORMAT_RGB_888,
222 CLUT_SIZE * CLUT_SIZE * 3,
225 material = clutter_texture_get_cogl_material(rc->texture);
226 cogl_material_set_layer(material, 1, tex3d);
227 cogl_handle_unref(tex3d);
228 DEBUG_0("%s clut end", get_exec_time());
229 rc->clut_updated = TRUE;
234 static void rc_sync_actor(RendererClutter *rc)
236 PixbufRenderer *pr = rc->pr;
240 clutter_actor_set_anchor_point(CLUTTER_ACTOR(rc->texture), 0, 0);
242 printf("scale %d %d\n", rc->pr->width, rc->pr->height);
243 printf("pos %d %d\n", rc->pr->x_offset, rc->pr->y_offset);
245 clutter_actor_set_scale(CLUTTER_ACTOR(rc->texture),
246 (gfloat)pr->width / pr->image_width,
247 (gfloat)pr->height / pr->image_height);
249 switch (pr->orientation)
251 case EXIF_ORIENTATION_TOP_LEFT:
253 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
256 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
262 case EXIF_ORIENTATION_TOP_RIGHT:
264 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
267 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
270 anchor_x = pr->width;
273 case EXIF_ORIENTATION_BOTTOM_RIGHT:
275 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
278 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
281 anchor_x = pr->width;
282 anchor_y = pr->height;
284 case EXIF_ORIENTATION_BOTTOM_LEFT:
286 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
289 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
293 anchor_y = pr->height;
295 case EXIF_ORIENTATION_LEFT_TOP:
296 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
299 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
305 case EXIF_ORIENTATION_RIGHT_TOP:
306 /* rotated -90 (270) */
307 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
310 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
314 anchor_y = pr->height;
316 case EXIF_ORIENTATION_RIGHT_BOTTOM:
317 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
320 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
323 anchor_x = pr->width;
324 anchor_y = pr->height;
326 case EXIF_ORIENTATION_LEFT_BOTTOM:
328 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
331 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->texture),
334 anchor_x = pr->width;
338 /* The other values are out of range */
342 clutter_actor_set_position(CLUTTER_ACTOR(rc->texture),
343 pr->x_offset - pr->x_scroll + anchor_x,
344 pr->y_offset - pr->y_scroll + anchor_y);
349 static void renderer_area_clip_add(RendererClutter *rc, gfloat x, gfloat y, gfloat w, gfloat h)
351 PixbufRenderer *pr = rc->pr;
353 gfloat clip_x, clip_y, clip_w, clip_h, clip_x2, clip_y2;
358 clutter_actor_get_clip(rc->texture, &clip_x, &clip_y, &clip_w, &clip_h);
360 clip_x2 = clip_x + clip_w;
361 clip_y2 = clip_y + clip_h;
363 if (clip_x > x) clip_x = x;
364 if (clip_x2 < x2) clip_x2 = x2;
365 if (clip_y > y) clip_y = y;
366 if (clip_y2 < y2) clip_y2 = y2;
368 clip_w = clip_x2 - clip_x;
369 clip_h = clip_y2 - clip_y;
371 printf("clip %f %f %f %f\n", clip_x, clip_y, clip_w, clip_h);
372 clutter_actor_set_clip(rc->texture, clip_x, clip_y, clip_w, clip_h);
375 #define MAX_REGION_AREA (32768 * 1024)
377 static gboolean renderer_area_changed_cb(gpointer data);
379 static void rc_schedule_texture_upload(RendererClutter *rc)
381 if (g_get_monotonic_time() - rc->last_pixbuf_change < 50000)
383 /* delay clutter redraw until the texture has some data
384 set priority between gtk redraw and clutter redraw */
385 rc->idle_update = g_idle_add_full(CLUTTER_PRIORITY_REDRAW - 10, renderer_area_changed_cb, rc, NULL);
389 /* higher prio than histogram */
390 rc->idle_update = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 5, renderer_area_changed_cb, rc, NULL);
394 static gboolean renderer_area_changed_cb(gpointer data)
396 RendererClutter *rc = (RendererClutter *)data;
397 PixbufRenderer *pr = rc->pr;
399 RendererClutterAreaParam *par = rc->pending_updates->data;
401 gint h = MAX_REGION_AREA / par->w;
403 if (h > par->h) h = par->h;
406 printf("renderer_area_changed_cb %d %d %d %d (%d)\n", par->x, par->y, par->w, h, par->h);
407 DEBUG_0("%s upload start", get_exec_time());
410 CoglHandle texture = clutter_texture_get_cogl_texture(CLUTTER_TEXTURE(rc->texture));
412 cogl_texture_set_region(texture,
413 par->x + GET_RIGHT_PIXBUF_OFFSET(rc),
421 gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
422 gdk_pixbuf_get_rowstride(pr->pixbuf),
423 gdk_pixbuf_get_pixels(pr->pixbuf));
425 DEBUG_0("%s upload end", get_exec_time());
426 renderer_area_clip_add(rc, par->x, par->y, par->w, h);
434 rc->pending_updates = g_list_remove(rc->pending_updates, par);
437 if (!rc->pending_updates)
439 clutter_actor_queue_redraw(CLUTTER_ACTOR(rc->texture));
442 /* FIXME: find a better place for this */
443 if (!rc->clut_updated) rc_prepare_post_process_lut(rc);
448 rc_schedule_texture_upload(rc);
450 return FALSE; /* it was rescheduled, possibly with different prio */
454 static void renderer_area_changed(void *renderer, gint src_x, gint src_y, gint src_w, gint src_h)
456 RendererClutter *rc = (RendererClutter *)renderer;
457 PixbufRenderer *pr = rc->pr;
458 RendererClutterAreaParam *par;
460 gint width = gdk_pixbuf_get_width(pr->pixbuf);
461 gint height = gdk_pixbuf_get_height(pr->pixbuf);
463 if (pr->stereo_data == STEREO_PIXBUF_SBS || pr->stereo_data == STEREO_PIXBUF_CROSS)
468 if (!pr_clip_region(src_x, src_y, src_w, src_h,
469 GET_RIGHT_PIXBUF_OFFSET(rc), 0, width, height,
470 &src_x, &src_y, &src_w, &src_h)) return;
472 par = g_new0(RendererClutterAreaParam, 1);
474 par->x = src_x - GET_RIGHT_PIXBUF_OFFSET(rc);
478 rc->pending_updates = g_list_append(rc->pending_updates, par);
479 if (!rc->idle_update)
481 rc_schedule_texture_upload(rc);
485 static void renderer_remove_pending_updates(RendererClutter *rc)
487 if (rc->idle_update) g_idle_remove_by_data(rc);
489 while (rc->pending_updates)
491 RendererClutterAreaParam *par = rc->pending_updates->data;
492 rc->pending_updates = g_list_remove(rc->pending_updates, par);
497 static void renderer_update_pixbuf(void *renderer, gboolean lazy)
499 RendererClutter *rc = (RendererClutter *)renderer;
500 PixbufRenderer *pr = rc->pr;
502 renderer_remove_pending_updates(rc);
506 gint width = gdk_pixbuf_get_width(pr->pixbuf);
507 gint height = gdk_pixbuf_get_height(pr->pixbuf);
509 gint prev_width, prev_height;
511 if (pr->stereo_data == STEREO_PIXBUF_SBS || pr->stereo_data == STEREO_PIXBUF_CROSS)
517 printf("renderer_update_pixbuf\n");
518 clutter_texture_get_base_size(CLUTTER_TEXTURE(rc->texture), &prev_width, &prev_height);
519 printf("change from %d %d to %d %d\n", prev_width, prev_height, width, height);
521 if (width != prev_width || height != prev_height)
523 /* FIXME use CoglMaterial with multiple textures for background, color management, anaglyph, ... */
524 CoglHandle texture = cogl_texture_new_with_size(width,
526 COGL_TEXTURE_NO_AUTO_MIPMAP,
527 gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888);
529 if (texture != COGL_INVALID_HANDLE)
531 clutter_texture_set_cogl_texture(CLUTTER_TEXTURE(rc->texture), texture);
532 cogl_handle_unref(texture);
535 clutter_actor_set_clip(rc->texture, 0, 0, 0, 0); /* visible area is extended as area_changed events arrive */
538 renderer_area_changed(renderer, GET_RIGHT_PIXBUF_OFFSET(rc), 0, width, height);
542 rc->clut_updated = FALSE;
543 rc->last_pixbuf_change = g_get_monotonic_time();
544 printf("renderer_update_pixbuf\n");
550 static void renderer_update_zoom(void *renderer, gboolean lazy)
552 RendererClutter *rc = (RendererClutter *)renderer;
553 PixbufRenderer *pr = rc->pr;
555 printf("renderer_update_zoom\n");
559 static void renderer_invalidate_region(void *renderer, gint x, gint y, gint w, gint h)
563 static OverlayData *rc_overlay_find(RendererClutter *rc, gint id)
567 work = rc->overlay_list;
570 OverlayData *od = work->data;
573 if (od->id == id) return od;
579 static void rc_overlay_actor_destroy_cb(ClutterActor *actor, gpointer user_data)
581 OverlayData *od = user_data;
585 static void rc_overlay_free(RendererClutter *rc, OverlayData *od)
587 rc->overlay_list = g_list_remove(rc->overlay_list, od);
589 if (od->pixbuf) g_object_unref(G_OBJECT(od->pixbuf));
590 if (od->actor) clutter_actor_destroy(od->actor);
594 static void rc_overlay_update_position(RendererClutter *rc, OverlayData *od)
598 pw = gdk_pixbuf_get_width(od->pixbuf);
599 ph = gdk_pixbuf_get_height(od->pixbuf);
603 if (od->flags & OVL_RELATIVE)
605 if (px < 0) px = rc->pr->viewport_width - pw + px;
606 if (py < 0) py = rc->pr->viewport_height - ph + py;
608 if (od->actor) clutter_actor_set_position(od->actor, px, py);
611 static void rc_overlay_update_positions(RendererClutter *rc)
615 work = rc->overlay_list;
618 OverlayData *od = work->data;
621 rc_overlay_update_position(rc, od);
625 static void rc_overlay_free_all(RendererClutter *rc)
629 work = rc->overlay_list;
632 OverlayData *od = work->data;
635 rc_overlay_free(rc, od);
640 static void renderer_overlay_draw(void *renderer, gint x, gint y, gint w, gint h)
644 static gint renderer_overlay_add(void *renderer, GdkPixbuf *pixbuf, gint x, gint y, OverlayRendererFlags flags)
646 RendererClutter *rc = (RendererClutter *)renderer;
647 PixbufRenderer *pr = rc->pr;
651 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), -1);
652 g_return_val_if_fail(pixbuf != NULL, -1);
655 while (rc_overlay_find(rc, id)) id++;
657 od = g_new0(OverlayData, 1);
660 g_object_ref(G_OBJECT(od->pixbuf));
665 od->actor = gtk_clutter_texture_new();
666 g_signal_connect (od->actor, "destroy", G_CALLBACK(rc_overlay_actor_destroy_cb), od);
668 gtk_clutter_texture_set_from_pixbuf(GTK_CLUTTER_TEXTURE (od->actor), pixbuf, NULL);
669 clutter_container_add_actor(CLUTTER_CONTAINER(rc->group), od->actor);
671 rc->overlay_list = g_list_append(rc->overlay_list, od);
672 rc_overlay_update_position(rc, od);
677 static void renderer_overlay_set(void *renderer, gint id, GdkPixbuf *pixbuf, gint x, gint y)
679 RendererClutter *rc = (RendererClutter *)renderer;
680 PixbufRenderer *pr = rc->pr;
683 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
685 od = rc_overlay_find(rc, id);
690 g_object_ref(G_OBJECT(pixbuf));
691 g_object_unref(G_OBJECT(od->pixbuf));
697 if (od->actor) gtk_clutter_texture_set_from_pixbuf(GTK_CLUTTER_TEXTURE(od->actor), pixbuf, NULL);
698 rc_overlay_update_position(rc, od);
702 rc_overlay_free(rc, od);
706 static gboolean renderer_overlay_get(void *renderer, gint id, GdkPixbuf **pixbuf, gint *x, gint *y)
708 RendererClutter *rc = (RendererClutter *)renderer;
710 PixbufRenderer *pr = rc->pr;
713 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
715 od = rc_overlay_find(rc, id);
716 if (!od) return FALSE;
718 if (pixbuf) *pixbuf = od->pixbuf;
726 static void renderer_update_sizes(void *renderer)
728 RendererClutter *rc = (RendererClutter *)renderer;
729 ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
731 rc->stereo_off_x = 0;
732 rc->stereo_off_y = 0;
734 if (rc->stereo_mode & PR_STEREO_RIGHT)
736 if (rc->stereo_mode & PR_STEREO_HORIZ)
738 rc->stereo_off_x = rc->pr->viewport_width;
740 else if (rc->stereo_mode & PR_STEREO_VERT)
742 rc->stereo_off_y = rc->pr->viewport_height;
744 else if (rc->stereo_mode & PR_STEREO_FIXED)
746 rc->stereo_off_x = rc->pr->stereo_fixed_x_right;
747 rc->stereo_off_y = rc->pr->stereo_fixed_y_right;
752 if (rc->stereo_mode & PR_STEREO_FIXED)
754 rc->stereo_off_x = rc->pr->stereo_fixed_x_left;
755 rc->stereo_off_y = rc->pr->stereo_fixed_y_left;
758 DEBUG_1("update size: %p %d %d %d %d", rc, rc->stereo_off_x, rc->stereo_off_y, rc->pr->viewport_width, rc->pr->viewport_height);
760 printf("renderer_update_sizes scale %d %d\n", rc->pr->width, rc->pr->height);
762 clutter_stage_set_color(CLUTTER_STAGE(rc->stage), &stage_color);
765 clutter_actor_set_size(rc->group, rc->pr->viewport_width, rc->pr->viewport_height);
766 clutter_actor_set_position(rc->group, rc->stereo_off_x, rc->stereo_off_y);
768 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->group),
770 (rc->stereo_mode & PR_STEREO_MIRROR) ? 180 : 0,
771 rc->pr->viewport_width / 2.0, 0, 0);
773 clutter_actor_set_rotation(CLUTTER_ACTOR(rc->group),
775 (rc->stereo_mode & PR_STEREO_FLIP) ? 180 : 0,
776 0, rc->pr->viewport_height / 2.0, 0);
779 rc_overlay_update_positions(rc);
782 static void renderer_scroll(void *renderer, gint x_off, gint y_off)
784 printf("renderer_scroll\n");
785 RendererClutter *rc = (RendererClutter *)renderer;
786 PixbufRenderer *pr = rc->pr;
791 static void renderer_stereo_set(void *renderer, gint stereo_mode)
793 RendererClutter *rc = (RendererClutter *)renderer;
795 rc->stereo_mode = stereo_mode;
798 static void renderer_free(void *renderer)
800 RendererClutter *rc = (RendererClutter *)renderer;
801 GtkWidget *widget = gtk_bin_get_child(GTK_BIN(rc->pr));
803 renderer_remove_pending_updates(rc);
805 rc_overlay_free_all(rc);
809 /* widget still exists */
810 clutter_actor_destroy(rc->group);
811 if (clutter_group_get_n_children(CLUTTER_GROUP(rc->stage)) == 0)
813 printf("destroy %p\n", rc->widget);
814 /* this was the last user */
815 gtk_widget_destroy(rc->widget);
819 printf("keep %p\n", rc->widget);
820 g_object_unref(G_OBJECT(rc->widget));
826 RendererFuncs *renderer_clutter_new(PixbufRenderer *pr)
828 RendererClutter *rc = g_new0(RendererClutter, 1);
832 rc->f.area_changed = renderer_area_changed;
833 rc->f.update_pixbuf = renderer_update_pixbuf;
834 rc->f.free = renderer_free;
835 rc->f.update_zoom = renderer_update_zoom;
836 rc->f.invalidate_region = renderer_invalidate_region;
837 rc->f.scroll = renderer_scroll;
838 rc->f.update_sizes = renderer_update_sizes;
841 rc->f.overlay_add = renderer_overlay_add;
842 rc->f.overlay_set = renderer_overlay_set;
843 rc->f.overlay_get = renderer_overlay_get;
844 rc->f.overlay_draw = renderer_overlay_draw;
846 rc->f.stereo_set = renderer_stereo_set;
850 rc->stereo_off_x = 0;
851 rc->stereo_off_y = 0;
854 rc->pending_updates = NULL;
856 rc->widget = gtk_bin_get_child(GTK_BIN(rc->pr));
860 if (!GTK_CLUTTER_IS_EMBED(rc->widget))
863 DEBUG_0("pixbuf renderer has a child of other type than gtk_clutter_embed");
869 rc->widget = gtk_clutter_embed_new();
870 gtk_container_add(GTK_CONTAINER(rc->pr), rc->widget);
873 gtk_event_box_set_above_child (GTK_EVENT_BOX(rc->pr), TRUE);
874 rc->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (rc->widget));
876 rc->group = clutter_group_new();
877 clutter_container_add_actor(CLUTTER_CONTAINER(rc->stage), rc->group);
878 clutter_actor_set_clip_to_allocation(CLUTTER_ACTOR(rc->group), TRUE);
880 rc->texture = clutter_texture_new ();
881 clutter_container_add_actor(CLUTTER_CONTAINER(rc->group), rc->texture);
882 rc_set_shader(clutter_texture_get_cogl_material(rc->texture));
883 g_object_ref(G_OBJECT(rc->widget));
885 gtk_widget_show(rc->widget);
886 return (RendererFuncs *) rc;
890 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */