stage: Do not use get_allocation_geometry()

It's pointless, and it will be deprecated soon.
This commit is contained in:
Emmanuele Bassi 2012-08-10 14:06:49 +01:00
parent 699a1876d4
commit ef1bb42a86

View File

@ -364,10 +364,11 @@ clutter_stage_allocate (ClutterActor *self,
ClutterAllocationFlags flags) ClutterAllocationFlags flags)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterGeometry prev_geom, geom; float old_width, old_height;
float new_width, new_height;
float width, height;
cairo_rectangle_int_t window_size; cairo_rectangle_int_t window_size;
gboolean origin_changed; gboolean origin_changed;
gint width, height;
origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED) origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED)
? TRUE ? TRUE
@ -377,11 +378,10 @@ clutter_stage_allocate (ClutterActor *self,
return; return;
/* our old allocation */ /* our old allocation */
clutter_actor_get_allocation_geometry (self, &prev_geom); clutter_actor_get_size (self, &old_width, &old_height);
/* the current allocation */ /* the current allocation */
width = clutter_actor_box_get_width (box); clutter_actor_box_get_size (box, &width, &height);
height = clutter_actor_box_get_height (box);
/* the current Stage implementation size */ /* the current Stage implementation size */
_clutter_stage_window_get_geometry (priv->impl, &window_size); _clutter_stage_window_get_geometry (priv->impl, &window_size);
@ -391,7 +391,7 @@ clutter_stage_allocate (ClutterActor *self,
* allocation chain - because we cannot forcibly change the size of the * allocation chain - because we cannot forcibly change the size of the
* stage window. * stage window.
*/ */
if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))) if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
{ {
CLUTTER_NOTE (LAYOUT, CLUTTER_NOTE (LAYOUT,
"Following allocation to %dx%d (origin %s)", "Following allocation to %dx%d (origin %s)",
@ -470,14 +470,15 @@ clutter_stage_allocate (ClutterActor *self,
window_size.height); window_size.height);
/* reset the viewport if the allocation effectively changed */ /* reset the viewport if the allocation effectively changed */
clutter_actor_get_allocation_geometry (self, &geom); clutter_actor_get_size (self, &new_width, &new_height);
if (geom.width != prev_geom.width ||
geom.height != prev_geom.height) if (old_width != new_width ||
old_height != new_height)
{ {
_clutter_stage_set_viewport (CLUTTER_STAGE (self), _clutter_stage_set_viewport (CLUTTER_STAGE (self),
0, 0, 0, 0,
geom.width, new_width,
geom.height); new_height);
/* Note: we don't assume that set_viewport will queue a full redraw /* Note: we don't assume that set_viewport will queue a full redraw
* since it may bail-out early if something preemptively set the * since it may bail-out early if something preemptively set the
@ -2836,7 +2837,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
gint width, gint width,
gint height) gint height)
{ {
ClutterGeometry geom; ClutterActorBox box;
guchar *pixels; guchar *pixels;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL); g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
@ -2845,13 +2846,13 @@ clutter_stage_read_pixels (ClutterStage *stage,
clutter_stage_ensure_current (stage); clutter_stage_ensure_current (stage);
clutter_actor_paint (CLUTTER_ACTOR (stage)); clutter_actor_paint (CLUTTER_ACTOR (stage));
clutter_actor_get_allocation_geometry (CLUTTER_ACTOR (stage), &geom); clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box);
if (width < 0) if (width < 0)
width = geom.width; width = box.x2 - box.x1;
if (height < 0) if (height < 0)
height = geom.height; height = box.y2 - box.y1;
pixels = g_malloc (height * width * 4); pixels = g_malloc (height * width * 4);