+2006-02-19 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdkgc.c (_gdk_gc_update_context): Add a gc_changed
+ argument, and avoid setting the clip region if the gc
+ has not changed.
+
+ * gdk/gdkgc.c: Update all callers.
+
+ * gdk/gdkpango.c (get_cairo_context): Avoid updating the
+ context if nothing changed.
+
2006-02-20 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkdisplay-quartz.c:
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
a cast.
+>>>>>>> 1.7541
2006-02-17 Matthias Clasen <mclasen@redhat.com>
DND keynav support:
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
Remove unnecessary checks.
+>>>>>>> 1.7533
2006-02-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
+2006-02-19 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/gdkgc.c (_gdk_gc_update_context): Add a gc_changed
+ argument, and avoid setting the clip region if the gc
+ has not changed.
+
+ * gdk/gdkgc.c: Update all callers.
+
+ * gdk/gdkpango.c (get_cairo_context): Avoid updating the
+ context if nothing changed.
+
2006-02-20 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkdisplay-quartz.c:
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
a cast.
+>>>>>>> 1.7541
2006-02-17 Matthias Clasen <mclasen@redhat.com>
DND keynav support:
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
Remove unnecessary checks.
+>>>>>>> 1.7533
2006-02-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
cairo_t *cr;
cr = gdk_cairo_create (drawable);
- _gdk_gc_update_context (gc, cr, NULL, NULL);
+ _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
if (matrix)
{
g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
cr = gdk_cairo_create (drawable);
- _gdk_gc_update_context (gc, cr, NULL, NULL);
+ _gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
for (i = 0; i < n_trapezoids; i++)
{
* stipple from the GC. If this is present and the fill mode
* of the GC isn't %GDK_STIPPLED or %GDK_OPAQUE_STIPPLED
* the fill mode will be forced to %GDK_STIPPLED
+ * @gc_changed: pass %FALSE if the @gc has not changed since the
+ * last call to this function
*
* Set the attributes of a cairo context to match those of a #GdkGC
* as far as possible. Some aspects of a #GdkGC, such as clip masks
_gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
GdkColor *override_foreground,
- GdkBitmap *override_stipple)
+ GdkBitmap *override_stipple,
+ gboolean gc_changed)
{
GdkGCPrivate *priv;
GdkFill fill;
cairo_pattern_destroy (pattern);
}
+ if (!gc_changed)
+ return;
+
cairo_reset_clip (cr);
if (priv->clip_region)
{
}
}
+
#define __GDK_GC_C__
#include "gdkaliasdef.c"
/* Current target */
GdkDrawable *drawable;
GdkGC *base_gc;
+
+ gboolean gc_changed;
};
static PangoAttrType gdk_pango_attr_stipple_type;
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
}
+static inline gboolean
+color_equal (PangoColor *c1, PangoColor *c2)
+{
+ if (!c1 && !c2)
+ return TRUE;
+
+ if (c1 && c2 &&
+ c1->red == c2->red &&
+ c1->green == c2->green &&
+ c1->blue == c2->blue)
+ return TRUE;
+
+ return FALSE;
+}
+
static cairo_t *
get_cairo_context (GdkPangoRenderer *gdk_renderer,
PangoRenderPart part)
cairo_set_matrix (priv->cr, &cairo_matrix);
}
}
-
- priv->last_part = (PangoRenderPart)-1;
+
if (part != priv->last_part)
{
- PangoColor *pango_color = pango_renderer_get_color (renderer,
- part);
- GdkColor *color = NULL;
+ PangoColor *pango_color;
+ GdkColor *color;
GdkColor tmp_color;
- if (pango_color)
+ gboolean changed;
+
+ pango_color = pango_renderer_get_color (renderer, part);
+
+ if (priv->last_part != -1)
+ changed = priv->gc_changed ||
+ priv->stipple[priv->last_part] != priv->stipple[part] ||
+ !color_equal (pango_color,
+ pango_renderer_get_color (renderer, priv->last_part));
+ else
+ changed = TRUE;
+
+ if (changed)
{
- tmp_color.red = pango_color->red;
- tmp_color.green = pango_color->green;
- tmp_color.blue = pango_color->blue;
-
- color = &tmp_color;
+ if (pango_color)
+ {
+ tmp_color.red = pango_color->red;
+ tmp_color.green = pango_color->green;
+ tmp_color.blue = pango_color->blue;
+
+ color = &tmp_color;
+ }
+ else
+ color = NULL;
+
+ _gdk_gc_update_context (priv->base_gc,
+ priv->cr,
+ color,
+ priv->stipple[part],
+ priv->gc_changed);
}
- _gdk_gc_update_context (priv->base_gc,
- priv->cr,
- color,
- priv->stipple[part]);
priv->last_part = part;
+ priv->gc_changed = FALSE;
}
return priv->cr;
GdkPangoRendererPrivate);
renderer->priv->last_part = (PangoRenderPart)-1;
+ renderer->priv->gc_changed = TRUE;
}
static void
priv->base_gc = gc;
if (priv->base_gc)
g_object_ref (priv->base_gc);
+
+ priv->gc_changed = TRUE;
}
}