1
0
Fork 0
Commit graph

5 commits

Author SHA1 Message Date
Emmanuele Bassi
264c67c2aa canvas: Allow invalidating the content along with the size
Currently, clutter_canvas_set_size() causes invalidation of the canvas
contents only if the newly set size is different. There are cases when
we want to invalidate the content regardless of the size set, but we
cannot do that right now without possibly causing two invalidations,
for instance:

  clutter_canvas_set_size (canvas, new_width, new_height);
  clutter_content_invalidate (canvas);

will cause two invalidations if the newly set size is different than
the existing one. One way to work around it is to check the current
size of the canvas and either call set_size() or invalidate() depending
on whether the size differs or not, respectively:

  g_object_get (canvas, "width", &width, "height", &height, NULL);
  if (width != new_width || height != new_height)
    clutter_canvas_set_size (canvas, new_width, new_height);
  else
    clutter_content_invalidate (canvas);

this, howevere, implies knowledge of the internals of ClutterCanvas,
and of its optimizations — and encodes a certain behaviour in third
party code, which makes changes further down the line harder.

We could remove the optimization, and just issue an invalidation
regardless of the surface size, but it's not something I'd be happy to
do. Instead, we can add a new function specifically for ClutterCanvas
that causes a forced invalidation regardless of the size change. If we
ever decide to remove the optimization further down the road, we can
simply deprecate the function, and make it an alias of invalidate()
or set_size().
2013-05-06 10:03:54 -07:00
Emmanuele Bassi
e5e10b6a04 Annotate functionality added in 1.10 2012-03-16 17:30:26 +00:00
Emmanuele Bassi
f2b9c17a78 canvas: Fix single header inclusion guard 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
0eeb61f3a8 canvas: Add canvas size to the ::draw signal
Instead of requiring a call to clutter_content_get_preferred_size(), we
can simply pass the canvas size to the Canvas::draw signal.
2012-03-16 12:33:37 +00:00
Emmanuele Bassi
07bb35bbe3 Add ClutterCanvas, a drawing content 2012-03-16 12:33:37 +00:00