From 9ff191bd3bfba0000547c3082e7fe6c57152bbe5 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Fri, 3 Dec 2010 16:56:54 +0000 Subject: [PATCH] pipeline: inline _get_parent and _get_authority This moves _cogl_pipeline_get_parent and _cogl_pipeline_get_authority into cogl-pipeline-private.h so they can be inlined since they have been seen to get quite high in profiles. Given that they both contain such small amounts of code the function call overhead is significant. --- clutter/cogl/cogl/cogl-pipeline-private.h | 17 +++++++++++++++++ clutter/cogl/cogl/cogl-pipeline.c | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clutter/cogl/cogl/cogl-pipeline-private.h b/clutter/cogl/cogl/cogl-pipeline-private.h index b4452b368..0e3b6c916 100644 --- a/clutter/cogl/cogl/cogl-pipeline-private.h +++ b/clutter/cogl/cogl/cogl-pipeline-private.h @@ -604,6 +604,23 @@ _cogl_pipeline_init_default_pipeline (void); void _cogl_pipeline_init_default_layers (void); +static inline CoglPipeline * +_cogl_pipeline_get_parent (CoglPipeline *pipeline) +{ + CoglPipelineNode *parent_node = COGL_PIPELINE_NODE (pipeline)->parent; + return COGL_PIPELINE (parent_node); +} + +static inline CoglPipeline * +_cogl_pipeline_get_authority (CoglPipeline *pipeline, + unsigned long difference) +{ + CoglPipeline *authority = pipeline; + while (!(authority->differences & difference)) + authority = _cogl_pipeline_get_parent (authority); + return authority; +} + /* * SECTION:cogl-pipeline-internals * @short_description: Functions for creating custom primitives that make use diff --git a/clutter/cogl/cogl/cogl-pipeline.c b/clutter/cogl/cogl/cogl-pipeline.c index 9d38c7535..7932911a2 100644 --- a/clutter/cogl/cogl/cogl-pipeline.c +++ b/clutter/cogl/cogl/cogl-pipeline.c @@ -551,23 +551,6 @@ _cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline) return pipeline->real_blend_enable; } -inline CoglPipeline * -_cogl_pipeline_get_parent (CoglPipeline *pipeline) -{ - CoglPipelineNode *parent_node = COGL_PIPELINE_NODE (pipeline)->parent; - return COGL_PIPELINE (parent_node); -} - -CoglPipeline * -_cogl_pipeline_get_authority (CoglPipeline *pipeline, - unsigned long difference) -{ - CoglPipeline *authority = pipeline; - while (!(authority->differences & difference)) - authority = _cogl_pipeline_get_parent (authority); - return authority; -} - /* XXX: Think twice before making this non static since it is used * heavily and we expect the compiler to inline it... */