Do not check for features inside class initialization
The class initialization function may be called when Clutter hasn't been fully initialized — for instance, when scanning the source with gtk-doc or with the introspection scanner.
This commit is contained in:
parent
553f446315
commit
c1a57e537b
@ -221,6 +221,7 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
|
|||||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterOffscreenEffectClass *offscreen_class;
|
ClutterOffscreenEffectClass *offscreen_class;
|
||||||
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
gobject_class->dispose = clutter_blur_effect_dispose;
|
gobject_class->dispose = clutter_blur_effect_dispose;
|
||||||
|
|
||||||
@ -232,18 +233,12 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
|
|||||||
|
|
||||||
klass->base_pipeline = cogl_pipeline_new ();
|
klass->base_pipeline = cogl_pipeline_new ();
|
||||||
|
|
||||||
if (clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
|
||||||
{
|
box_blur_glsl_declarations,
|
||||||
CoglSnippet *snippet;
|
NULL);
|
||||||
|
cogl_snippet_set_replace (snippet, box_blur_glsl_shader);
|
||||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
|
cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
|
||||||
box_blur_glsl_declarations,
|
cogl_object_unref (snippet);
|
||||||
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,
|
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
|
||||||
0, /* layer number */
|
0, /* layer number */
|
||||||
|
@ -227,6 +227,7 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
|
|||||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterOffscreenEffectClass *offscreen_class;
|
ClutterOffscreenEffectClass *offscreen_class;
|
||||||
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
||||||
offscreen_class->paint_target = clutter_colorize_effect_paint_target;
|
offscreen_class->paint_target = clutter_colorize_effect_paint_target;
|
||||||
@ -258,16 +259,11 @@ clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
|
|||||||
|
|
||||||
klass->base_pipeline = cogl_pipeline_new ();
|
klass->base_pipeline = cogl_pipeline_new ();
|
||||||
|
|
||||||
if (clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||||
{
|
colorize_glsl_declarations,
|
||||||
CoglSnippet *snippet;
|
colorize_glsl_source);
|
||||||
|
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
|
||||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
cogl_object_unref (snippet);
|
||||||
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,
|
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
|
||||||
0, /* layer number */
|
0, /* layer number */
|
||||||
|
@ -249,6 +249,7 @@ clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass)
|
|||||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterOffscreenEffectClass *offscreen_class;
|
ClutterOffscreenEffectClass *offscreen_class;
|
||||||
|
CoglSnippet *snippet;
|
||||||
|
|
||||||
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
|
||||||
offscreen_class->paint_target = clutter_desaturate_effect_paint_target;
|
offscreen_class->paint_target = clutter_desaturate_effect_paint_target;
|
||||||
@ -281,16 +282,11 @@ clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass)
|
|||||||
|
|
||||||
klass->base_pipeline = cogl_pipeline_new ();
|
klass->base_pipeline = cogl_pipeline_new ();
|
||||||
|
|
||||||
if (clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
|
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
||||||
{
|
desaturate_glsl_declarations,
|
||||||
CoglSnippet *snippet;
|
desaturate_glsl_source);
|
||||||
|
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
|
||||||
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
|
cogl_object_unref (snippet);
|
||||||
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,
|
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
|
||||||
0, /* layer number */
|
0, /* layer number */
|
||||||
|
Loading…
Reference in New Issue
Block a user