ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterOffscreenEffectClass *offscreen_class;
- CoglSnippet *snippet;
gobject_class->dispose = clutter_blur_effect_dispose;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->paint_target = clutter_blur_effect_paint_target;
-
- klass->base_pipeline = cogl_pipeline_new ();
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
- box_blur_glsl_declarations,
- NULL);
- cogl_snippet_set_replace (snippet, box_blur_glsl_shader);
- cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
- 0, /* layer number */
- COGL_TEXTURE_TYPE_2D);
}
static void
clutter_blur_effect_init (ClutterBlurEffect *self)
{
- CoglPipeline *base_pipeline =
- CLUTTER_BLUR_EFFECT_GET_CLASS (self)->base_pipeline;
+ ClutterBlurEffectClass *klass = CLUTTER_BLUR_EFFECT_GET_CLASS (self);
+
+ if (G_UNLIKELY (klass->base_pipeline == NULL))
+ {
+ CoglSnippet *snippet;
+
+ klass->base_pipeline = cogl_pipeline_new ();
+
+ snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
+ box_blur_glsl_declarations,
+ NULL);
+ cogl_snippet_set_replace (snippet, box_blur_glsl_shader);
+ cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
+ cogl_object_unref (snippet);
+
+ cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
+ 0, /* layer number */
+ COGL_TEXTURE_TYPE_2D);
+ }
- self->pipeline = cogl_pipeline_copy (base_pipeline);
+ self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
self->pixel_step_uniform =
cogl_pipeline_get_uniform_location (self->pipeline, "pixel_step");
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterOffscreenEffectClass *offscreen_class;
- CoglSnippet *snippet;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->paint_target = clutter_colorize_effect_paint_target;
&default_tint,
CLUTTER_PARAM_READWRITE);
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-
-
- klass->base_pipeline = cogl_pipeline_new ();
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- colorize_glsl_declarations,
- colorize_glsl_source);
- cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
- 0, /* layer number */
- COGL_TEXTURE_TYPE_2D);
+ g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
static void
clutter_colorize_effect_init (ClutterColorizeEffect *self)
{
- CoglPipeline *base_pipeline =
- CLUTTER_COLORIZE_EFFECT_GET_CLASS (self)->base_pipeline;
+ ClutterColorizeEffectClass *klass = CLUTTER_COLORIZE_EFFECT_GET_CLASS (self);
+
+ if (G_UNLIKELY (klass->base_pipeline == NULL))
+ {
+ CoglSnippet *snippet;
+
+ klass->base_pipeline = cogl_pipeline_new ();
+
+ snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
+ colorize_glsl_declarations,
+ colorize_glsl_source);
+ cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
+ cogl_object_unref (snippet);
+
+ cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
+ 0, /* layer number */
+ COGL_TEXTURE_TYPE_2D);
+ }
- self->pipeline = cogl_pipeline_copy (base_pipeline);
+ self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
self->tint_uniform =
cogl_pipeline_get_uniform_location (self->pipeline, "tint");
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterOffscreenEffectClass *offscreen_class;
- CoglSnippet *snippet;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->paint_target = clutter_desaturate_effect_paint_target;
gobject_class->set_property = clutter_desaturate_effect_set_property;
gobject_class->get_property = clutter_desaturate_effect_get_property;
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-
- klass->base_pipeline = cogl_pipeline_new ();
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- desaturate_glsl_declarations,
- desaturate_glsl_source);
- cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
- 0, /* layer number */
- COGL_TEXTURE_TYPE_2D);
+ g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
clutter_desaturate_effect_init (ClutterDesaturateEffect *self)
{
- CoglPipeline *base_pipeline =
- CLUTTER_DESATURATE_EFFECT_GET_CLASS (self)->base_pipeline;
+ ClutterDesaturateEffectClass *klass = CLUTTER_DESATURATE_EFFECT_GET_CLASS (self);
+
+ if (G_UNLIKELY (klass->base_pipeline == NULL))
+ {
+ CoglSnippet *snippet;
+
+ klass->base_pipeline = cogl_pipeline_new ();
+
+ snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
+ desaturate_glsl_declarations,
+ desaturate_glsl_source);
+ cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
+ cogl_object_unref (snippet);
+
+ cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
+ 0, /* layer number */
+ COGL_TEXTURE_TYPE_2D);
+ }
- self->pipeline = cogl_pipeline_copy (base_pipeline);
+ self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
self->factor_uniform =
cogl_pipeline_get_uniform_location (self->pipeline, "factor");