Add a gc_changed argument, and avoid setting the clip region if the gc has
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.
This commit is contained in:

committed by
Matthias Clasen

parent
ba8e91b9fc
commit
3c9432eeb6
13
ChangeLog
13
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
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>
|
2006-02-20 Anders Carlsson <andersca@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkdisplay-quartz.c:
|
* gdk/quartz/gdkdisplay-quartz.c:
|
||||||
@ -75,6 +86,7 @@
|
|||||||
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
|
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
|
||||||
a cast.
|
a cast.
|
||||||
|
|
||||||
|
>>>>>>> 1.7541
|
||||||
2006-02-17 Matthias Clasen <mclasen@redhat.com>
|
2006-02-17 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
DND keynav support:
|
DND keynav support:
|
||||||
@ -113,6 +125,7 @@
|
|||||||
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
|
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
|
||||||
Remove unnecessary checks.
|
Remove unnecessary checks.
|
||||||
|
|
||||||
|
>>>>>>> 1.7533
|
||||||
2006-02-12 Matthias Clasen <mclasen@redhat.com>
|
2006-02-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
|
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
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>
|
2006-02-20 Anders Carlsson <andersca@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkdisplay-quartz.c:
|
* gdk/quartz/gdkdisplay-quartz.c:
|
||||||
@ -75,6 +86,7 @@
|
|||||||
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
|
* gtk/gtklinkbutton.c (gtk_link_button_class_init): Fix
|
||||||
a cast.
|
a cast.
|
||||||
|
|
||||||
|
>>>>>>> 1.7541
|
||||||
2006-02-17 Matthias Clasen <mclasen@redhat.com>
|
2006-02-17 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
DND keynav support:
|
DND keynav support:
|
||||||
@ -113,6 +125,7 @@
|
|||||||
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
|
* gtk/gtkcolorbutton.c (gtk_color_button_[un]realize):
|
||||||
Remove unnecessary checks.
|
Remove unnecessary checks.
|
||||||
|
|
||||||
|
>>>>>>> 1.7533
|
||||||
2006-02-12 Matthias Clasen <mclasen@redhat.com>
|
2006-02-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
|
* gtk/gtkicontheme.c (gtk_icon_theme_list_icons): Give working
|
||||||
|
@ -881,7 +881,7 @@ real_draw_glyphs (GdkDrawable *drawable,
|
|||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
cr = gdk_cairo_create (drawable);
|
cr = gdk_cairo_create (drawable);
|
||||||
_gdk_gc_update_context (gc, cr, NULL, NULL);
|
_gdk_gc_update_context (gc, cr, NULL, NULL, TRUE);
|
||||||
|
|
||||||
if (matrix)
|
if (matrix)
|
||||||
{
|
{
|
||||||
@ -1005,7 +1005,7 @@ gdk_draw_trapezoids (GdkDrawable *drawable,
|
|||||||
g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
|
g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
|
||||||
|
|
||||||
cr = gdk_cairo_create (drawable);
|
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++)
|
for (i = 0; i < n_trapezoids; i++)
|
||||||
{
|
{
|
||||||
|
@ -1112,6 +1112,8 @@ gc_get_background (GdkGC *gc,
|
|||||||
* stipple from the GC. If this is present and the fill mode
|
* stipple from the GC. If this is present and the fill mode
|
||||||
* of the GC isn't %GDK_STIPPLED or %GDK_OPAQUE_STIPPLED
|
* of the GC isn't %GDK_STIPPLED or %GDK_OPAQUE_STIPPLED
|
||||||
* the fill mode will be forced to %GDK_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
|
* 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
|
* as far as possible. Some aspects of a #GdkGC, such as clip masks
|
||||||
@ -1121,7 +1123,8 @@ void
|
|||||||
_gdk_gc_update_context (GdkGC *gc,
|
_gdk_gc_update_context (GdkGC *gc,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
GdkColor *override_foreground,
|
GdkColor *override_foreground,
|
||||||
GdkBitmap *override_stipple)
|
GdkBitmap *override_stipple,
|
||||||
|
gboolean gc_changed)
|
||||||
{
|
{
|
||||||
GdkGCPrivate *priv;
|
GdkGCPrivate *priv;
|
||||||
GdkFill fill;
|
GdkFill fill;
|
||||||
@ -1226,6 +1229,9 @@ _gdk_gc_update_context (GdkGC *gc,
|
|||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gc_changed)
|
||||||
|
return;
|
||||||
|
|
||||||
cairo_reset_clip (cr);
|
cairo_reset_clip (cr);
|
||||||
if (priv->clip_region)
|
if (priv->clip_region)
|
||||||
{
|
{
|
||||||
@ -1243,5 +1249,6 @@ _gdk_gc_update_context (GdkGC *gc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define __GDK_GC_C__
|
#define __GDK_GC_C__
|
||||||
#include "gdkaliasdef.c"
|
#include "gdkaliasdef.c"
|
||||||
|
@ -57,6 +57,8 @@ struct _GdkPangoRendererPrivate
|
|||||||
/* Current target */
|
/* Current target */
|
||||||
GdkDrawable *drawable;
|
GdkDrawable *drawable;
|
||||||
GdkGC *base_gc;
|
GdkGC *base_gc;
|
||||||
|
|
||||||
|
gboolean gc_changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static PangoAttrType gdk_pango_attr_stipple_type;
|
static PangoAttrType gdk_pango_attr_stipple_type;
|
||||||
@ -130,6 +132,21 @@ emboss_context (cairo_t *cr)
|
|||||||
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
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 *
|
static cairo_t *
|
||||||
get_cairo_context (GdkPangoRenderer *gdk_renderer,
|
get_cairo_context (GdkPangoRenderer *gdk_renderer,
|
||||||
PangoRenderPart part)
|
PangoRenderPart part)
|
||||||
@ -155,28 +172,46 @@ get_cairo_context (GdkPangoRenderer *gdk_renderer,
|
|||||||
cairo_set_matrix (priv->cr, &cairo_matrix);
|
cairo_set_matrix (priv->cr, &cairo_matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->last_part = (PangoRenderPart)-1;
|
|
||||||
if (part != priv->last_part)
|
if (part != priv->last_part)
|
||||||
{
|
{
|
||||||
PangoColor *pango_color = pango_renderer_get_color (renderer,
|
PangoColor *pango_color;
|
||||||
part);
|
GdkColor *color;
|
||||||
GdkColor *color = NULL;
|
|
||||||
GdkColor tmp_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;
|
if (pango_color)
|
||||||
tmp_color.green = pango_color->green;
|
{
|
||||||
tmp_color.blue = pango_color->blue;
|
tmp_color.red = pango_color->red;
|
||||||
|
tmp_color.green = pango_color->green;
|
||||||
color = &tmp_color;
|
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->last_part = part;
|
||||||
|
priv->gc_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return priv->cr;
|
return priv->cr;
|
||||||
@ -482,6 +517,7 @@ gdk_pango_renderer_init (GdkPangoRenderer *renderer)
|
|||||||
GdkPangoRendererPrivate);
|
GdkPangoRendererPrivate);
|
||||||
|
|
||||||
renderer->priv->last_part = (PangoRenderPart)-1;
|
renderer->priv->last_part = (PangoRenderPart)-1;
|
||||||
|
renderer->priv->gc_changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -653,6 +689,8 @@ gdk_pango_renderer_set_gc (GdkPangoRenderer *gdk_renderer,
|
|||||||
priv->base_gc = gc;
|
priv->base_gc = gc;
|
||||||
if (priv->base_gc)
|
if (priv->base_gc)
|
||||||
g_object_ref (priv->base_gc);
|
g_object_ref (priv->base_gc);
|
||||||
|
|
||||||
|
priv->gc_changed = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user