render: Add renderops trampolines for CSS functions
This commit is contained in:
@@ -31,9 +31,7 @@
|
||||
#include "gtkcssshadowsvalueprivate.h"
|
||||
#include "gtkcsstransformvalueprivate.h"
|
||||
#include "gtkhslaprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtkrenderopsprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
#include "fallback-c89.c"
|
||||
@@ -57,7 +55,7 @@ gtk_do_render_check (GtkStyleContext *context,
|
||||
else
|
||||
image_type = GTK_CSS_IMAGE_BUILTIN_CHECK;
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +120,7 @@ gtk_do_render_option (GtkStyleContext *context,
|
||||
else
|
||||
image_type = GTK_CSS_IMAGE_BUILTIN_OPTION;
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +197,7 @@ gtk_do_render_arrow (GtkStyleContext *context,
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, size, size, image_type);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, size, size, image_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +278,9 @@ gtk_render_background (GtkStyleContext *context,
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gtk_css_style_render_background (gtk_style_context_lookup_style (context),
|
||||
cr, x, y, width, height,
|
||||
gtk_style_context_get_junction_sides (context));
|
||||
gtk_render_ops_draw_background (gtk_style_context_lookup_style (context),
|
||||
cr, x, y, width, height,
|
||||
gtk_style_context_get_junction_sides (context));
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
@@ -322,11 +320,11 @@ gtk_render_frame (GtkStyleContext *context,
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gtk_css_style_render_border (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
x, y, width, height,
|
||||
0,
|
||||
gtk_style_context_get_junction_sides (context));
|
||||
gtk_render_ops_draw_border (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
x, y, width, height,
|
||||
0,
|
||||
gtk_style_context_get_junction_sides (context));
|
||||
|
||||
|
||||
cairo_restore (cr);
|
||||
@@ -367,7 +365,7 @@ gtk_do_render_expander (GtkStyleContext *context,
|
||||
: GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT;
|
||||
}
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,9 +443,9 @@ gtk_render_focus (GtkStyleContext *context,
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gtk_css_style_render_outline (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
x, y, width, height);
|
||||
gtk_render_ops_draw_outline (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
x, y, width, height);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
@@ -604,15 +602,15 @@ gtk_do_render_slider (GtkStyleContext *context,
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
junction = gtk_style_context_get_junction_sides (context);
|
||||
|
||||
gtk_css_style_render_background (style,
|
||||
cr,
|
||||
x, y, width, height,
|
||||
junction);
|
||||
gtk_css_style_render_border (style,
|
||||
cr,
|
||||
x, y, width, height,
|
||||
0,
|
||||
junction);
|
||||
gtk_render_ops_draw_background (style,
|
||||
cr,
|
||||
x, y, width, height,
|
||||
junction);
|
||||
gtk_render_ops_draw_border (style,
|
||||
cr,
|
||||
x, y, width, height,
|
||||
0,
|
||||
junction);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,9 +749,9 @@ gtk_css_style_render_frame_gap (GtkCssStyle *style,
|
||||
cairo_rectangle (cr, x0, yc + hc, x1 - x0, y1 - (yc + hc));
|
||||
cairo_clip (cr);
|
||||
|
||||
gtk_css_style_render_border (style, cr,
|
||||
x, y, width, height,
|
||||
0, junction);
|
||||
gtk_render_ops_draw_border (style, cr,
|
||||
x, y, width, height,
|
||||
0, junction);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
@@ -851,15 +849,15 @@ gtk_css_style_render_extension (GtkCssStyle *style,
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_style_render_background (style,
|
||||
cr,
|
||||
x, y,
|
||||
width, height,
|
||||
junction);
|
||||
gtk_render_ops_draw_background (style,
|
||||
cr,
|
||||
x, y,
|
||||
width, height,
|
||||
junction);
|
||||
|
||||
gtk_css_style_render_border (style, cr,
|
||||
x, y, width, height,
|
||||
hidden_side, junction);
|
||||
gtk_render_ops_draw_border (style, cr,
|
||||
x, y, width, height,
|
||||
hidden_side, junction);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -954,7 +952,7 @@ gtk_do_render_handle (GtkStyleContext *context,
|
||||
type = GTK_CSS_IMAGE_BUILTIN_HANDLE;
|
||||
}
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, type);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1030,7 +1028,7 @@ gtk_render_activity (GtkStyleContext *context,
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, GTK_CSS_IMAGE_BUILTIN_SPINNER);
|
||||
gtk_render_ops_draw_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, GTK_CSS_IMAGE_BUILTIN_SPINNER);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
@@ -1224,10 +1222,10 @@ gtk_render_icon (GtkStyleContext *context,
|
||||
|
||||
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
|
||||
|
||||
gtk_css_style_render_icon_surface (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
surface,
|
||||
x, y);
|
||||
gtk_render_ops_draw_icon_surface (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
surface,
|
||||
x, y);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
@@ -1259,10 +1257,10 @@ gtk_render_icon_surface (GtkStyleContext *context,
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gtk_css_style_render_icon_surface (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
surface,
|
||||
x, y);
|
||||
gtk_render_ops_draw_icon_surface (gtk_style_context_lookup_style (context),
|
||||
cr,
|
||||
surface,
|
||||
x, y);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "gtkrenderopsprivate.h"
|
||||
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkRenderOps, gtk_render_ops, G_TYPE_OBJECT)
|
||||
|
||||
static cairo_t *
|
||||
@@ -40,11 +44,79 @@ gtk_render_ops_real_end_draw_widget (GtkRenderOps *ops,
|
||||
cairo_destroy (draw_cr);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_render_ops_real_draw_background (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkJunctionSides junction)
|
||||
{
|
||||
gtk_css_style_render_background (style, cr, x, y, width, height, junction);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_real_draw_border (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
guint hidden_side,
|
||||
GtkJunctionSides junction)
|
||||
{
|
||||
gtk_css_style_render_border (style, cr, x, y, width, height, hidden_side, junction);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_real_draw_outline (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
gtk_css_style_render_outline (style, cr, x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_real_draw_icon (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
GtkCssImageBuiltinType builtin_type)
|
||||
{
|
||||
gtk_css_style_render_icon (style, cr, x, y, width, height, builtin_type);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_real_draw_icon_surface (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
cairo_surface_t *surface,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
gtk_css_style_render_icon_surface (style, cr, surface, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_render_ops_class_init (GtkRenderOpsClass *klass)
|
||||
{
|
||||
klass->begin_draw_widget = gtk_render_ops_real_begin_draw_widget;
|
||||
klass->end_draw_widget = gtk_render_ops_real_end_draw_widget;
|
||||
klass->draw_background = gtk_render_ops_real_draw_background;
|
||||
klass->draw_border = gtk_render_ops_real_draw_border;
|
||||
klass->draw_outline = gtk_render_ops_real_draw_outline;
|
||||
klass->draw_icon = gtk_render_ops_real_draw_icon;
|
||||
klass->draw_icon_surface = gtk_render_ops_real_draw_icon_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -105,3 +177,107 @@ gtk_render_ops_end_draw_widget (GtkWidget *widget,
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->end_draw_widget (ops, widget, draw_cr, original_cr);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_draw_background (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkJunctionSides junction)
|
||||
{
|
||||
GtkRenderOps *ops;
|
||||
|
||||
ops = gtk_cairo_get_render_ops (cr);
|
||||
if (ops == NULL)
|
||||
{
|
||||
gtk_render_ops_real_draw_background (NULL, style, cr, x, y, width, height, junction);
|
||||
return;
|
||||
}
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->draw_background (ops, style, cr, x, y, width, height, junction);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_draw_border (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
guint hidden_side,
|
||||
GtkJunctionSides junction)
|
||||
{
|
||||
GtkRenderOps *ops;
|
||||
|
||||
ops = gtk_cairo_get_render_ops (cr);
|
||||
if (ops == NULL)
|
||||
{
|
||||
gtk_render_ops_real_draw_border (NULL, style, cr, x, y, width, height, hidden_side, junction);
|
||||
return;
|
||||
}
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->draw_border (ops, style, cr, x, y, width, height, hidden_side, junction);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_draw_outline (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
GtkRenderOps *ops;
|
||||
|
||||
ops = gtk_cairo_get_render_ops (cr);
|
||||
if (ops == NULL)
|
||||
{
|
||||
gtk_render_ops_real_draw_outline (NULL, style, cr, x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->draw_outline (ops, style, cr, x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_draw_icon (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
GtkCssImageBuiltinType builtin_type)
|
||||
{
|
||||
GtkRenderOps *ops;
|
||||
|
||||
ops = gtk_cairo_get_render_ops (cr);
|
||||
if (ops == NULL)
|
||||
{
|
||||
gtk_render_ops_real_draw_icon (NULL, style, cr, x, y, width, height, builtin_type);
|
||||
return;
|
||||
}
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->draw_icon (ops, style, cr, x, y, width, height, builtin_type);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_render_ops_draw_icon_surface (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
cairo_surface_t *surface,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
GtkRenderOps *ops;
|
||||
|
||||
ops = gtk_cairo_get_render_ops (cr);
|
||||
if (ops == NULL)
|
||||
{
|
||||
gtk_render_ops_real_draw_icon_surface (NULL, style, cr, surface, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
GTK_RENDER_OPS_GET_CLASS (ops)->draw_icon_surface (ops, style, cr, surface, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <cairo.h>
|
||||
|
||||
#include <gtk/gtktypes.h>
|
||||
#include "gtkcssimagebuiltinprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -52,6 +53,44 @@ struct _GtkRenderOpsClass
|
||||
GtkWidget *widget,
|
||||
cairo_t *draw_cr,
|
||||
cairo_t *original_cr);
|
||||
void (* draw_background) (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkJunctionSides junction);
|
||||
void (* draw_border) (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
guint hidden_side,
|
||||
GtkJunctionSides junction);
|
||||
void (* draw_outline) (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height);
|
||||
void (* draw_icon) (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
GtkCssImageBuiltinType builtin_type);
|
||||
void (* draw_icon_surface) (GtkRenderOps *ops,
|
||||
GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
cairo_surface_t *surface,
|
||||
double x,
|
||||
double y);
|
||||
};
|
||||
|
||||
GType gtk_render_ops_get_type (void) G_GNUC_CONST;
|
||||
@@ -67,6 +106,40 @@ void gtk_render_ops_end_draw_widget (GtkWidget
|
||||
cairo_t *draw_cr,
|
||||
cairo_t *original_cr);
|
||||
|
||||
void gtk_render_ops_draw_background (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkJunctionSides junction);
|
||||
void gtk_render_ops_draw_border (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
guint hidden_side,
|
||||
GtkJunctionSides junction);
|
||||
void gtk_render_ops_draw_outline (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height);
|
||||
void gtk_render_ops_draw_icon (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
GtkCssImageBuiltinType builtin_type);
|
||||
void gtk_render_ops_draw_icon_surface (GtkCssStyle *style,
|
||||
cairo_t *cr,
|
||||
cairo_surface_t *surface,
|
||||
double x,
|
||||
double y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDER_OPS_PRIVATE_H__ */
|
||||
|
||||
Reference in New Issue
Block a user