| 26 | namespace faker |
| 27 | { |
| 28 | class EGLXWindowHash : public HASH |
| 29 | { |
| 30 | public: |
| 31 | |
| 32 | static EGLXWindowHash *getInstance(void) |
| 33 | { |
| 34 | if(instance == NULL) |
| 35 | { |
| 36 | util::CriticalSection::SafeLock l(instanceMutex); |
| 37 | if(instance == NULL) instance = new EGLXWindowHash; |
| 38 | } |
| 39 | return instance; |
| 40 | } |
| 41 | |
| 42 | static bool isAlloc(void) { return instance != NULL; } |
| 43 | |
| 44 | void add(EGLXDisplay *eglxdpy, EGLSurface surface, |
| 45 | EGLXVirtualWin *eglxvw) |
| 46 | { |
| 47 | if(!eglxdpy || !surface || !eglxvw) THROW("Invalid argument"); |
| 48 | HASH::add(eglxdpy, surface, eglxvw); |
| 49 | } |
| 50 | |
| 51 | EGLXVirtualWin *find(EGLXDisplay *eglxdpy, EGLSurface surface) |
| 52 | { |
| 53 | if(!eglxdpy || !surface) return NULL; |
| 54 | return HASH::find(eglxdpy, surface); |
| 55 | } |
| 56 | |
| 57 | EGLXVirtualWin *find(Display *dpy, Window win) |
| 58 | { |
| 59 | if(!dpy || !win) return NULL; |
| 60 | |
| 61 | HashEntry *entry = NULL; |
| 62 | util::CriticalSection::SafeLock l(mutex); |
| 63 | |
| 64 | entry = start; |
| 65 | while(entry != NULL) |
| 66 | { |
| 67 | if(entry->value->getX11Display() == dpy |
| 68 | && entry->value->getX11Drawable() == win) |
| 69 | return entry->value; |
| 70 | entry = entry->next; |
| 71 | } |
| 72 | return NULL; |
| 73 | } |
| 74 | |
| 75 | // Find the EGLXVirtualWin instance corresponding to the real EGL |
| 76 | // surface, not the dummy EGL surface that we passed back to the 3D |
| 77 | // application. |
| 78 | EGLXVirtualWin *findInternal(EGLXDisplay *eglxdpy, EGLSurface surface) |
| 79 | { |
| 80 | if(!eglxdpy || !surface) return NULL; |
| 81 | |
| 82 | HashEntry *entry = NULL; |
| 83 | util::CriticalSection::SafeLock l(mutex); |
| 84 | |
| 85 | entry = start; |
nothing calls this directly
no outgoing calls
no test coverage detected