[Mesa-dev] [PATCH 1/5] mesa: refactor clamping controls, get rid of _ClampReadColor

Brian Paul brianp at vmware.com
Fri Mar 29 08:20:51 PDT 2013


On 03/28/2013 03:24 PM, Marek Olšák wrote:
> ---
>   src/mesa/main/blend.c       |   28 +++++++++++++++++++++++++++-
>   src/mesa/main/blend.h       |    8 ++++++++
>   src/mesa/main/fbobject.c    |   10 ++++++++++
>   src/mesa/main/framebuffer.c |    1 +
>   src/mesa/main/mtypes.h      |    4 +++-
>   src/mesa/main/readpix.c     |    5 +++--
>   src/mesa/main/state.c       |   29 +++--------------------------
>   7 files changed, 55 insertions(+), 30 deletions(-)
>
> diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
> index 309f1d5..876cbf2 100644
> --- a/src/mesa/main/blend.c
> +++ b/src/mesa/main/blend.c
> @@ -782,7 +782,34 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
>      }
>   }
>
> +static GLboolean _mesa_get_clamp_color(const struct gl_framebuffer *fb,
> +                                       GLenum clamp)

You don't need the _mesa_ prefix on static functions.  And some 
reformatting, so:

static GLboolean
get_clamp_color(const struct gl_framebuffer *fb, GLenum clamp)



> +{
> +   if (clamp == GL_TRUE || clamp == GL_FALSE)
> +      return clamp;
> +
> +   ASSERT(clamp == GL_FIXED_ONLY);
> +   if (!fb)
> +      return GL_TRUE;
>
> +   return fb->_AllColorBuffersFixedPoint;
> +}
> +
> +GLboolean _mesa_get_clamp_fragment_color(const struct gl_context *ctx)

Minor formatting nit:

GLboolean
_mesa_get_clamp_fragment_color(const struct gl_context *ctx)


> +{
> +   return _mesa_get_clamp_color(ctx->DrawBuffer,
> +                                ctx->Color.ClampFragmentColor);
> +}
> +
> +GLboolean _mesa_get_clamp_vertex_color(const struct gl_context *ctx)
> +{
> +   return _mesa_get_clamp_color(ctx->DrawBuffer, ctx->Light.ClampVertexColor);
> +}
> +
> +GLboolean _mesa_get_clamp_read_color(const struct gl_context *ctx)
> +{
> +   return _mesa_get_clamp_color(ctx->ReadBuffer, ctx->Color.ClampReadColor);
> +}
>

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list