[gtk+/gtk-style-context] GtkThemingEngine: Handle prelight transitions in render_layout()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context] GtkThemingEngine: Handle prelight transitions in render_layout()
- Date: Wed, 24 Nov 2010 22:38:16 +0000 (UTC)
commit 8d63bbf2fee4cdf2b006edce61e7c48d674d492b
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Nov 24 23:21:03 2010 +0100
GtkThemingEngine: Handle prelight transitions in render_layout()
gtk/gtkthemingengine.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 63b27ba..4b44502 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -2019,6 +2019,8 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
GdkRGBA *fg_color;
GtkStateFlags flags;
GdkScreen *screen;
+ gdouble progress;
+ gboolean running;
cairo_save (cr);
flags = gtk_theming_engine_get_state (engine);
@@ -2030,6 +2032,33 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
screen = gtk_theming_engine_get_screen (engine);
matrix = pango_context_get_matrix (pango_layout_get_context (layout));
+ running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
+
+ if (running)
+ {
+ GtkStateFlags other_flags;
+ GdkRGBA *other_fg;
+
+ if (flags & GTK_STATE_FLAG_PRELIGHT)
+ {
+ other_flags = flags & ~(GTK_STATE_FLAG_PRELIGHT);
+ progress = 1 - progress;
+ }
+ else
+ other_flags = flags | GTK_STATE_FLAG_PRELIGHT;
+
+ gtk_theming_engine_get (engine, other_flags,
+ "color", &other_fg,
+ NULL);
+
+ fg_color->red = CLAMP (fg_color->red + ((other_fg->red - fg_color->red) * progress), 0, 1);
+ fg_color->green = CLAMP (fg_color->green + ((other_fg->green - fg_color->green) * progress), 0, 1);
+ fg_color->blue = CLAMP (fg_color->blue + ((other_fg->blue - fg_color->blue) * progress), 0, 1);
+ fg_color->alpha = CLAMP (fg_color->alpha + ((other_fg->alpha - fg_color->alpha) * progress), 0, 1);
+
+ gdk_rgba_free (other_fg);
+ }
+
if (matrix)
{
cairo_matrix_t cairo_matrix;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]