diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2015-03-11 13:21:29 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2015-10-25 21:41:22 +0100 |
commit | 1780d4b43b7e6bb9452d710d66a541098bcb9ccc (patch) | |
tree | 493d66ac44dbead5d7ccb290d40bf27823f2c03e | |
parent | 773442b170c3a29693f7c6624d785c94e4cc7cb1 (diff) |
fosphor/gl_cmap: Add a return value and void* arg to the generate func
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | lib/fosphor/gl.c | 4 | ||||
-rw-r--r-- | lib/fosphor/gl_cmap.c | 4 | ||||
-rw-r--r-- | lib/fosphor/gl_cmap.h | 4 | ||||
-rw-r--r-- | lib/fosphor/gl_cmap_gen.c | 12 | ||||
-rw-r--r-- | lib/fosphor/gl_cmap_gen.h | 4 |
5 files changed, 16 insertions, 12 deletions
diff --git a/lib/fosphor/gl.c b/lib/fosphor/gl.c index 74f175e..8b8fe4b 100644 --- a/lib/fosphor/gl.c +++ b/lib/fosphor/gl.c @@ -279,9 +279,9 @@ fosphor_gl_init(struct fosphor *self) rv = (gl->cmap_ctx == NULL); rv |= fosphor_gl_cmap_generate(&gl->cmap_waterfall, - fosphor_gl_cmap_waterfall, 256); + fosphor_gl_cmap_waterfall, NULL, 256); rv |= fosphor_gl_cmap_generate(&gl->cmap_histogram, - fosphor_gl_cmap_histogram, 256); + fosphor_gl_cmap_histogram, NULL, 256); if (rv) goto error; diff --git a/lib/fosphor/gl_cmap.c b/lib/fosphor/gl_cmap.c index d4b367d..cf347ac 100644 --- a/lib/fosphor/gl_cmap.c +++ b/lib/fosphor/gl_cmap.c @@ -297,7 +297,7 @@ fosphor_gl_cmap_draw_scale(GLuint cmap_id, int -fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, int N) +fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, void *gfn_arg, int N) { uint32_t *rgba; @@ -313,7 +313,7 @@ fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, int N) glBindTexture(GL_TEXTURE_1D, *cmap_id); /* Generate texture data */ - gfn(rgba, N); + gfn(rgba, N, gfn_arg); /* Upload data */ glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, N, 0, diff --git a/lib/fosphor/gl_cmap.h b/lib/fosphor/gl_cmap.h index cbb0c40..ba1eb26 100644 --- a/lib/fosphor/gl_cmap.h +++ b/lib/fosphor/gl_cmap.h @@ -56,8 +56,8 @@ void fosphor_gl_cmap_disable(void); void fosphor_gl_cmap_draw_scale(GLuint cmap_id, float x0, float x1, float y0, float y1); -typedef void (*gl_cmap_gen_func_t)(uint32_t *rgba, int N); -int fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, int N); +typedef int (*gl_cmap_gen_func_t)(uint32_t *rgba, int N, void *arg); +int fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, void *gfn_arg, int N); /*! @} */ diff --git a/lib/fosphor/gl_cmap_gen.c b/lib/fosphor/gl_cmap_gen.c index 3c1c3dd..2d0c35c 100644 --- a/lib/fosphor/gl_cmap_gen.c +++ b/lib/fosphor/gl_cmap_gen.c @@ -128,8 +128,8 @@ _set_rgba_from_hsv(uint32_t *rgba, float h, float s, float v) } -void -fosphor_gl_cmap_histogram(uint32_t *rgba, int N) +int +fosphor_gl_cmap_histogram(uint32_t *rgba, int N, void *arg) { int i; int m = N >> 4; @@ -155,11 +155,13 @@ fosphor_gl_cmap_histogram(uint32_t *rgba, int N) 0.60f + ((p < 0.40f) ? p : 0.40f) ); } + + return 0; } -void -fosphor_gl_cmap_waterfall(uint32_t *rgba, int N) +int +fosphor_gl_cmap_waterfall(uint32_t *rgba, int N, void *arg) { int i; @@ -173,6 +175,8 @@ fosphor_gl_cmap_waterfall(uint32_t *rgba, int N) ((p * 0.95f) + 0.05f) /* V */ ); } + + return 0; } /*! @} */ diff --git a/lib/fosphor/gl_cmap_gen.h b/lib/fosphor/gl_cmap_gen.h index 4ea6bb6..df98878 100644 --- a/lib/fosphor/gl_cmap_gen.h +++ b/lib/fosphor/gl_cmap_gen.h @@ -32,8 +32,8 @@ #include <stdint.h> -void fosphor_gl_cmap_histogram(uint32_t *rgba, int N); -void fosphor_gl_cmap_waterfall(uint32_t *rgba, int N); +int fosphor_gl_cmap_histogram(uint32_t *rgba, int N, void *arg); +int fosphor_gl_cmap_waterfall(uint32_t *rgba, int N, void *arg); /*! @} */ |