| 504 | |
| 505 | |
| 506 | EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, |
| 507 | NativeWindowType native_window, const EGLint *attrib_list) |
| 508 | { |
| 509 | EGLSurface surface = 0, actualSurface = 0; |
| 510 | |
| 511 | TRY(); |
| 512 | |
| 513 | if(IS_EXCLUDED_EGLX(display)) |
| 514 | return _eglCreateWindowSurface(display, config, native_window, |
| 515 | attrib_list); |
| 516 | |
| 517 | GET_DISPLAY_INIT(EGL_NOT_INITIALIZED); |
| 518 | DISABLE_FAKER(); |
| 519 | |
| 520 | ///////////////////////////////////////////////////////////////////////////// |
| 521 | OPENTRACE(eglCreateWindowSurface); PRARGX(display); |
| 522 | PRARGEC(eglxdpy, config); PRARGX(native_window); PRARGALEGL(attrib_list); |
| 523 | STARTTRACE(); |
| 524 | ///////////////////////////////////////////////////////////////////////////// |
| 525 | |
| 526 | if(attrib_list) |
| 527 | { |
| 528 | for(int i = 0; i < MAX_ATTRIBS && attrib_list[i] != EGL_NONE; i += 2) |
| 529 | { |
| 530 | if(attrib_list[i] == EGL_LARGEST_PBUFFER || attrib_list[i] == EGL_WIDTH |
| 531 | || attrib_list[i] == EGL_HEIGHT) |
| 532 | { |
| 533 | faker::setEGLError(EGL_BAD_ATTRIBUTE); |
| 534 | goto done; |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | if(!config) |
| 540 | faker::setEGLError(EGL_BAD_CONFIG); |
| 541 | else if(!native_window) |
| 542 | faker::setEGLError(EGL_BAD_NATIVE_WINDOW); |
| 543 | else |
| 544 | { |
| 545 | faker::EGLXVirtualWin *eglxvw = |
| 546 | EGLXWINHASH.find(eglxdpy->x11dpy, native_window); |
| 547 | if(eglxvw) |
| 548 | faker::setEGLError(EGL_BAD_ALLOC); |
| 549 | else |
| 550 | { |
| 551 | eglxvw = new faker::EGLXVirtualWin(eglxdpy->x11dpy, native_window, |
| 552 | display, config, attrib_list); |
| 553 | surface = eglxvw->getDummySurface(); |
| 554 | actualSurface = (EGLSurface)eglxvw->getGLXDrawable(); |
| 555 | EGLXWINHASH.add(eglxdpy, surface, eglxvw); |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | done: |
| 560 | ///////////////////////////////////////////////////////////////////////////// |
| 561 | STOPTRACE(); PRARGX(surface); if(actualSurface) PRARGX(actualSurface); |
| 562 | CLOSETRACE(); |
| 563 | ///////////////////////////////////////////////////////////////////////////// |
no test coverage detected