After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611750 - Rework StDrawingArea not to use ClutterCairoTexture
Rework StDrawingArea not to use ClutterCairoTexture
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 612511
 
 
Reported: 2010-03-03 23:12 UTC by Owen Taylor
Modified: 2010-03-11 20:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Rework StDrawingArea not to use ClutterCairoTexture (20.58 KB, patch)
2010-03-03 23:12 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-03-03 23:12:09 UTC
Having StDrawingArea use ClutterCairoTexture causes circularity
problems with sizing - StDrawingArea wants to use its allocation for
the size of the texture, but ClutterTexture wants to use the size of
the texture to determine the requited size.

Avoid this by making StDrawingArea directly use Cairo and CoglTexture;
while doing this, the API is changed a bit for simplicity and to
match our use case:

 - Instead of clutter_cairo_texture_create(), we have
   st_drawing_area_get_context() to retrieve an already created
   context. This can only be called in the ::repaint signal.

 - The ::redraw signal is changed to ::repaint so we can have
   st_drawing_area_queue_repaint() that doesn't collide with
   clutter_actor_queue_redraw()

 - ::repaint is now emitted lazily when painting the actor rather
   than synchronously at various different points.
Comment 1 Owen Taylor 2010-03-03 23:12:12 UTC
Created attachment 155175 [details] [review]
Rework StDrawingArea not to use ClutterCairoTexture
Comment 2 Colin Walters 2010-03-05 16:27:32 UTC
Review of attachment 155175 [details] [review]:

One small comment, otherwise this looks nice to me.

::: src/st/st-drawing-area.c
@@ +228,3 @@
+st_drawing_area_get_context (StDrawingArea *area)
+ */
+ * Return Value: (transfer none): the Cairo context for the paint operation

This would look cleaner to me if priv was assigned at top and the assertions were together.

@@ +253,3 @@
+
+
+  StDrawingAreaPrivate *priv;

Ditto.
Comment 3 Owen Taylor 2010-03-05 16:51:20 UTC
Review of attachment 155175 [details] [review]:

::: src/st/st-drawing-area.c
@@ +228,3 @@
+
+  priv = area->priv;
+  g_return_val_if_fail (priv->in_repaint, NULL);

If you assign priv before you check SET_IS_DRAWING_AREA you segfault on NULL area rather than producing the desired warning. What we could do is just not use priv in the return if fails:

 StDrawingAreaPrivate *priv;

 g_return_val_if_fail (ST_IS_DRAWING_AREA (area), NULL);
 g_return_val_if_fail (area->priv->in_repaint, NULL);

 priv = area->priv;

 return priv->context;

OK, in that case you'd probably just eleminate priv entirely, but if you were doing more complex stuff you might still want to assign priv after not using it in the g_return_val_if_fail(). Does that seem like a better approach?
Comment 4 Colin Walters 2010-03-05 16:54:33 UTC
Review of attachment 155175 [details] [review]:

Yeah, that approach looks nice to me.
Comment 5 Owen Taylor 2010-03-11 20:09:29 UTC
Attachment 155175 [details] pushed as 33dca51 - Rework StDrawingArea not to use ClutterCairoTexture