[gtk+/wip/css: 129/154] borderimage: Add _gtk_border_image_new_for_context()



commit 954efe570396c87024c2062509a6958c41a6f365
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jan 4 04:00:58 2012 +0100

    borderimage: Add _gtk_border_image_new_for_context()
    
    and use it.

 gtk/gtkborderimage.c        |   16 ++++++++++++++++
 gtk/gtkborderimageprivate.h |    1 +
 gtk/gtkthemingengine.c      |    4 ++--
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkborderimage.c b/gtk/gtkborderimage.c
index 4f1d0c1..f13b0a8 100644
--- a/gtk/gtkborderimage.c
+++ b/gtk/gtkborderimage.c
@@ -28,6 +28,7 @@
 
 #include "gtkborderimageprivate.h"
 #include "gtkstylepropertiesprivate.h"
+#include "gtkthemingengineprivate.h"
 
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
@@ -73,6 +74,21 @@ _gtk_border_image_new (GtkCssImage             *source,
 }
 
 GtkBorderImage *
+_gtk_border_image_new_for_engine (GtkThemingEngine *engine)
+{
+  GtkCssImage *source;
+
+  source = g_value_get_object (_gtk_theming_engine_peek_property (engine, "border-image-source"));
+  if (source == NULL)
+    return NULL;
+
+  return _gtk_border_image_new (source,
+                                g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-slice")),
+                                g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-width")),
+                                g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-repeat")));
+}
+
+GtkBorderImage *
 _gtk_border_image_ref (GtkBorderImage *image)
 {
   g_return_val_if_fail (image != NULL, NULL);
diff --git a/gtk/gtkborderimageprivate.h b/gtk/gtkborderimageprivate.h
index 39b3eb0..f9654da 100644
--- a/gtk/gtkborderimageprivate.h
+++ b/gtk/gtkborderimageprivate.h
@@ -43,6 +43,7 @@ GtkBorderImage *  _gtk_border_image_new              (GtkCssImage          *sour
                                                       GtkBorder            *slice,
                                                       GtkBorder            *width,
                                                       GtkCssBorderImageRepeat *repeat);
+GtkBorderImage *  _gtk_border_image_new_for_engine   (GtkThemingEngine     *engine);
 
 GtkBorderImage *  _gtk_border_image_ref              (GtkBorderImage       *image);
 void              _gtk_border_image_unref            (GtkBorderImage       *image);
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 57e16e5..edcd5c4 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1552,8 +1552,8 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
   junction = gtk_theming_engine_get_junction_sides (engine);
   gtk_theming_engine_get_border (engine, flags, &border);
 
+  border_image = _gtk_border_image_new_for_engine (engine);
   gtk_theming_engine_get (engine, flags,
-			  "border-image", &border_image,
 			  "border-style", &border_style,
 			  NULL);
 
@@ -1920,8 +1920,8 @@ gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
   junction = gtk_theming_engine_get_junction_sides (engine);
 
   gtk_theming_engine_get_border (engine, state, &border);
+  border_image = _gtk_border_image_new_for_engine (engine);
   gtk_theming_engine_get (engine, state,
-			  "border-image", &border_image,
 			  "border-top-left-radius", &top_left_radius,
 			  "border-top-right-radius", &top_right_radius,
 			  "border-bottom-right-radius", &bottom_right_radius,



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