3 * Copyright (c) 2013 Jolla Ltd.
4 * Contact: Thomas Perl <thomas.perl@jollamobile.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
27 /* Keep track of active EGL window surfaces */
28 static std::map
<EGLSurface
,EGLNativeWindowType
> _surface_window_map
;
31 void egl_helper_push_mapping(EGLSurface surface
, EGLNativeWindowType window
)
33 assert(!egl_helper_has_mapping(surface
));
35 _surface_window_map
[surface
] = window
;
38 int egl_helper_has_mapping(EGLSurface surface
)
40 return (_surface_window_map
.find(surface
) != _surface_window_map
.end());
43 EGLNativeWindowType
egl_helper_pop_mapping(EGLSurface surface
)
45 std::map
<EGLSurface
,EGLNativeWindowType
>::iterator it
;
46 it
= _surface_window_map
.find(surface
);
48 /* Caller must check with egl_helper_has_mapping() before */
49 assert(it
!= _surface_window_map
.end());
51 EGLNativeWindowType result
= it
->second
;
52 _surface_window_map
.erase(it
);