1 /* 2 * Copyright (c) 2016, The Linux Foundation. All rights reserved. 3 * Not a Contribution. 4 * 5 * Copyright 2015 The Android Open Source Project 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 #ifndef __EGLIMAGE_BUFFER_H__ 21 #define __EGLIMAGE_BUFFER_H__ 22 23 #include <cutils/native_handle.h> 24 #include <gralloc_priv.h> 25 #include <ui/GraphicBuffer.h> 26 #include "engine.h" 27 28 class EGLImageBuffer { 29 // android::sp<android::GraphicBuffer> graphicBuffer; 30 void *eglImageID; 31 int width; 32 int height; 33 uint textureID; 34 uint renderbufferID; 35 uint framebufferID; 36 37 public: 38 int getWidth(); 39 int getHeight(); 40 EGLImageBuffer(android::sp<android::GraphicBuffer>); 41 unsigned int getTexture(); 42 unsigned int getFramebuffer(); 43 void bindAsTexture(); 44 void bindAsFramebuffer(); 45 ~EGLImageBuffer(); 46 static EGLImageBuffer *from(const private_handle_t *src); 47 static void clear(); 48 }; 49 50 #endif //__EGLIMAGE_BUFFER_H__