Re: Cairo based engine api for GTK+ 3.0

On Thu, 2009-06-18 at 11:33 +0100, Thomas Wood wrote:
> On Thu, 2009-06-18 at 11:26 +0100, Chris Wilson wrote:
> > The use of pango_cairo_layout_path(); cairo_fill(); is a performance
> > nightmare, use pango_cairo_show_layout() instead. [The difference
> > between the two is that pango_cairo_layout_path() will extract the paths
> > from the glyphs and fill by sending very long lists of trapezoids to the
> > X server every time, whereas pango_cairo_show_layout() will cache the
> > glyphs masks on the X server (as pixmaps) and just issue a short list of
> > indices to composite. So the latter is far more computationally, memory
> > and bandwidth efficient.]
> Do you know of a more efficient way to do this, but still using cairo?
> Alternatively, we could remove draw_layout() from the engine API. It
> isn't used a lot, normally only to make insensitive text look nicer than
> the default implementation...

Just to clarify: do you want a cairo equivalent for the stipple effect
or how to replace pango_cairo_layout_path()?

As the code currently stands:
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 628b952..01d81e6 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -5140,17 +5140,14 @@ gtk_default_draw_layout (GtkStyle        *style,
       gdk_cairo_set_source_color (cr, &style->white);
       cairo_move_to (cr, x + 1, y + 1);
-      pango_cairo_layout_path (cr, layout);
-      cairo_fill (cr);
+      pango_cairo_show_layout (cr, layout);
   gc = use_text ? &style->text[state_type] : &style->fg[state_type];
-  cairo_move_to (cr, x, y);
   gdk_cairo_set_source_color (cr, gc);
-  pango_cairo_layout_path (cr, layout);
-  cairo_fill (cr);
+  cairo_move_to (cr, x, y);
+  pango_cairo_show_layout (cr, layout);
   cairo_destroy (cr);

I'll take a closer look at the stippling now :-)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]