static void st_polygon_pick (ClutterActor *self, const ClutterColor *pick_color) { CoglPath *selection_path; gfloat coords[8]; StPolygon *area = ST_POLYGON (self); StPolygonPrivate *priv = area->priv; if (!clutter_actor_should_pick_paint (self)) return; coords[0] = priv->ulc_x; coords[1] = priv->ulc_y; coords[2] = priv->llc_x; coords[3] = priv->llc_y; coords[4] = priv->lrc_x; coords[5] = priv->lrc_y; coords[6] = priv->urc_x; coords[7] = priv->urc_y; cogl_set_source_color4ub (pick_color->red, pick_color->green, pick_color->blue, pick_color->alpha); selection_path = cogl_path_new(); cogl_path_polygon (selection_path, (float *)coords, 4); cogl_path_fill (selection_path); cogl_object_unref (selection_path); }
static void mx_menu_floating_pick (ClutterActor *menu, const ClutterColor *color) { gint i; MxMenuPrivate *priv = MX_MENU (menu)->priv; /* chain up to get bounding rectangle */ MX_FLOATING_WIDGET_CLASS (mx_menu_parent_class)->floating_pick (menu, color); /* pick children */ for (i = priv->id_offset; i <= priv->last_shown_id; i++) { MxMenuChild *child = &g_array_index (priv->children, MxMenuChild, i); if (clutter_actor_should_pick_paint (CLUTTER_ACTOR (child->box))) { clutter_actor_paint (CLUTTER_ACTOR (child->box)); } } if(priv->scrolling_mode) { clutter_actor_paint(priv->up_button); clutter_actor_paint(priv->down_button); } }
static void meta_surface_actor_pick (ClutterActor *actor, const ClutterColor *color) { MetaSurfaceActor *self = META_SURFACE_ACTOR (actor); MetaSurfaceActorPrivate *priv = meta_surface_actor_get_instance_private (self); ClutterActorIter iter; ClutterActor *child; if (!clutter_actor_should_pick_paint (actor)) return; /* If there is no region then use the regular pick */ if (priv->input_region == NULL) CLUTTER_ACTOR_CLASS (meta_surface_actor_parent_class)->pick (actor, color); else { int n_rects; float *rectangles; int i; CoglPipeline *pipeline; CoglContext *ctx; CoglFramebuffer *fb; CoglColor cogl_color; n_rects = cairo_region_num_rectangles (priv->input_region); rectangles = g_alloca (sizeof (float) * 4 * n_rects); for (i = 0; i < n_rects; i++) { cairo_rectangle_int_t rect; int pos = i * 4; cairo_region_get_rectangle (priv->input_region, i, &rect); rectangles[pos + 0] = rect.x; rectangles[pos + 1] = rect.y; rectangles[pos + 2] = rect.x + rect.width; rectangles[pos + 3] = rect.y + rect.height; } ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); fb = cogl_get_draw_framebuffer (); cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha); pipeline = cogl_pipeline_new (ctx); cogl_pipeline_set_color (pipeline, &cogl_color); cogl_framebuffer_draw_rectangles (fb, pipeline, rectangles, n_rects); cogl_object_unref (pipeline); } clutter_actor_iter_init (&iter, actor); while (clutter_actor_iter_next (&iter, &child)) clutter_actor_paint (child); }
static void mx_toolbar_pick (ClutterActor *actor, const ClutterColor *color) { MxToolbarPrivate *priv = MX_TOOLBAR (actor)->priv; CLUTTER_ACTOR_CLASS (mx_toolbar_parent_class)->pick (actor, color); if (priv->child) clutter_actor_paint (priv->child); if (priv->close_button && clutter_actor_should_pick_paint (priv->close_button)) clutter_actor_paint (priv->close_button); }
IO_METHOD(IoClutterActor, shouldPickPaint) { return IOBOOL(self, clutter_actor_should_pick_paint(IOCACTOR(self))); }