2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ANDROID_HWUI_IMAGE_H
18 #define ANDROID_HWUI_IMAGE_H
21 #include <EGL/eglext.h>
23 #include <GLES2/gl2.h>
24 #include <GLES2/gl2ext.h>
26 #include <ui/GraphicBuffer.h>
29 namespace uirenderer {
32 * A simple wrapper that creates an EGLImage and a texture for a GraphicBuffer.
37 * Creates a new image from the specified graphic buffer. If the image
38 * cannot be created, getTexture() will return 0 and getImage() will
39 * return EGL_NO_IMAGE_KHR.
41 Image(sp<GraphicBuffer> buffer);
45 * Returns the name of the GL texture that can be used to sample
48 GLuint getTexture() const {
53 * Returns the name of the EGL image represented by this object.
55 EGLImageKHR getImage() const {
64 }; // namespace uirenderer
65 }; // namespace android
67 #endif // ANDROID_HWUI_IMAGE_H