166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer/*
266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer**
366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** Copyright 2012, The Android Open Source Project
466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer**
566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** Licensed under the Apache License, Version 2.0 (the "License");
666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** you may not use this file except in compliance with the License.
766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** You may obtain a copy of the License at
866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer**
966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer**     http://www.apache.org/licenses/LICENSE-2.0
1066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer**
1166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** Unless required by applicable law or agreed to in writing, software
1266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** distributed under the License is distributed on an "AS IS" BASIS,
1366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** See the License for the specific language governing permissions and
1566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer** limitations under the License.
1666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer*/
1766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer
1866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshoferpackage android.opengl;
1966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer
2066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer/**
21c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer * Base class for wrapped EGL objects.
22c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer *
2366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer */
2466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshoferpublic abstract class EGLObjectHandle {
2566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer    private final int mHandle;
2666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer
27c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer    protected EGLObjectHandle(int handle) {
2866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer        mHandle = handle;
2966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer    }
3066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer
31c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer    /**
32c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     * Returns the native handle of the wrapped EGL object. This handle can be
33c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     * cast to the corresponding native type on the native side.
34c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     *
35c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     * For example, EGLDisplay dpy = (EGLDisplay)handle;
36c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     *
37c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     * @return the native handle of the wrapped EGL object.
38c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer     */
3966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer    public int getHandle() {
4066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer        return mHandle;
4166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer    }
42c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer
43c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer    @Override
44c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer    public int hashCode() {
45c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer        return getHandle();
46c5ee93e5fe2de4390ee96fb3b14c41f6ca45f5a2Thomas Tafertshofer    }
4766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer}
48