[Mesa-dev] [PATCH 12/15] egl: add eglCreateImage
Emil Velikov
emil.l.velikov at gmail.com
Fri May 15 10:51:18 PDT 2015
On 12/05/15 22:54, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/egl/main/eglapi.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 6457798..34a113b 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -251,6 +251,30 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
> }
>
>
> +static EGLint *
> +_eglConvertAttribsToInt(const EGLAttrib *attr_list)
> +{
> + EGLint *int_attribs = NULL;
> +
> + /* Convert attributes from EGLAttrib[] to EGLint[] */
> + if (attr_list) {
> + int i, size = 0;
> +
> + while (attr_list[size] != EGL_NONE)
> + size += 2;
> +
> + if (size) {
> + size += 1; /* add space for EGL_NONE */
> + int_attribs = malloc(size * sizeof(int_attribs[0]));
> +
> + for (i = 0; i < size; i++)
> + int_attribs[i] = attr_list[i];
In the unlikely event that malloc fails, it'll be nice to not crash.
-Emil
More information about the mesa-dev
mailing list