diff options
author | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:41:45 +0900 |
---|---|---|
committer | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:41:45 +0900 |
commit | 65db3453b2d83c113f9f7a939e386353ce348866 (patch) | |
tree | 93daea8d0cfed389b9f89b82d3a7bf739d8ebb58 /egl_1_4/35CreatePbufferFromClientBuffer.c | |
parent | 90dff65a3ccb36853763486671163ca81274b677 (diff) | |
download | simulator-opengl-ae89808f0cf51ba9c5bb2819bac2d130f6923ebe.tar.gz simulator-opengl-ae89808f0cf51ba9c5bb2819bac2d130f6923ebe.tar.bz2 simulator-opengl-ae89808f0cf51ba9c5bb2819bac2d130f6923ebe.zip |
Tizen 2.0 Releasesubmit/tizen_2.0/20130215.192024tizen_2.0
Diffstat (limited to 'egl_1_4/35CreatePbufferFromClientBuffer.c')
-rwxr-xr-x | egl_1_4/35CreatePbufferFromClientBuffer.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/egl_1_4/35CreatePbufferFromClientBuffer.c b/egl_1_4/35CreatePbufferFromClientBuffer.c new file mode 100755 index 0000000..01c3fd1 --- /dev/null +++ b/egl_1_4/35CreatePbufferFromClientBuffer.c @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, + EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_SURFACE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_SURFACE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_SURFACE; + } + if (pConfig->surfaceType & EGL_PBUFFER_BIT == 0) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + if (buftype != EGL_OPENVG_IMAGE) { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + struct SurfaceExtra surfaceValue; + memcpy(&surfaceValue, &surfaceExtraDefault, sizeof(struct SurfaceExtra)); + surfaceValue.renderBuffer = EGL_BACK_BUFFER; + int buf[32]; + int* ptr = &buf[0]; + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_WIDTH: + *ptr++ = GLX_WIDTH; + *ptr++ = *attrib_list++; + break; + case EGL_HEIGHT: + *ptr++ = GLX_HEIGHT; + *ptr++ = *attrib_list++; + break; + case EGL_TEXTURE_FORMAT: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_RGB + || *attrib_list == EGL_TEXTURE_RGBA) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_TEXTURE_TARGET: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_2D) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_MIPMAP_TEXTURE: + surfaceValue.mipmapTexture = (*attrib_list++ == EGL_FALSE) ? EGL_FALSE : EGL_TRUE; + break; + case EGL_VG_ALPHA_FORMAT: + if (*attrib_list == EGL_VG_ALPHA_FORMAT_NONPRE + || *attrib_list == EGL_VG_ALPHA_FORMAT_PRE) { + surfaceValue.vgAlphaFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_VG_COLORSPACE: + if (*attrib_list == EGL_VG_COLORSPACE_sRGB + || *attrib_list == EGL_VG_COLORSPACE_LINEAR) { + surfaceValue.vgColorSpace = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_SURFACE; + } + } + *ptr = None; + + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_NO_SURFACE; +} |