snippet: Move the hook to be a property of the snippet

Instead of specifying the hook point when adding to the pipeline using
a separate function for each hook, the hook is now a property of the
snippet. The hook is set on construction and is then read-only.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2011-11-25 20:54:14 +00:00
committed by Robert Bragg
parent 5be5a03343
commit 09c2e4abe7
12 changed files with 270 additions and 174 deletions

View File

@ -38,19 +38,30 @@ _cogl_snippet_free (CoglSnippet *snippet);
COGL_OBJECT_DEFINE (Snippet, snippet);
CoglSnippet *
cogl_snippet_new (const char *declarations,
cogl_snippet_new (CoglSnippetHook hook,
const char *declarations,
const char *post)
{
CoglSnippet *snippet = g_slice_new0 (CoglSnippet);
_cogl_snippet_object_new (snippet);
snippet->hook = hook;
cogl_snippet_set_declarations (snippet, declarations);
cogl_snippet_set_post (snippet, post);
return snippet;
}
CoglSnippetHook
cogl_snippet_get_hook (CoglSnippet *snippet)
{
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), 0);
return snippet->hook;
}
static gboolean
_cogl_snippet_modify (CoglSnippet *snippet)
{