picking: avoid redundant picking geometry for the stage.

The stage's pick id can be written to the framebuffer when we call
cogl_clear so there's no need for the stage to also chain up in it's pick
function resulting in clutter-actor.c also emitting a rectangle for the
stage.
This commit is contained in:
Robert Bragg 2009-11-25 20:37:01 +00:00
parent c12470666e
commit 47db7af4d3
2 changed files with 10 additions and 8 deletions

View File

@ -474,7 +474,7 @@ _clutter_do_pick (ClutterStage *stage,
{
ClutterMainContext *context;
guchar pixel[4] = { 0xff, 0xff, 0xff, 0xff };
CoglColor white;
CoglColor stage_pick_id;
guint32 id;
GLboolean dither_was_on;
@ -491,9 +491,9 @@ _clutter_do_pick (ClutterStage *stage,
if (G_LIKELY (!(clutter_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
cogl_clip_push_window_rectangle (x, y, 1, 1);
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
cogl_disable_fog ();
cogl_clear (&white,
cogl_color_set_from_4ub (&stage_pick_id, 0, 0, 0, 255);
cogl_clear (&stage_pick_id,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH);

View File

@ -67,6 +67,7 @@
#include "clutter-stage-window.h"
#include "clutter-version.h" /* For flavour */
#include "clutter-id-pool.h"
#include "clutter-container.h"
#include "cogl/cogl.h"
@ -282,12 +283,13 @@ static void
clutter_stage_pick (ClutterActor *self,
const ClutterColor *color)
{
/* Paint nothing, cogl_paint_init() effectively paints the stage
* silhouette for us - see _clutter_do_pick().
* Chain up to the groups paint howerer so our children get picked
* - clutter_group_pick
/* Note: we don't chain up to our parent as we don't want any geometry
* emitted for the stage itself. The stage's pick id is effectively handled
* by the call to cogl_clear done in clutter-main.c:_clutter_do_pick_async()
*/
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->pick (self, color);
clutter_container_foreach (CLUTTER_CONTAINER (self),
CLUTTER_CALLBACK (clutter_actor_paint), NULL);
}
static void