1 // 2 // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // NativeBufferImageSiblingAndroid.h: Defines the NativeBufferImageSiblingAndroid to wrap EGL images 8 // created from ANativeWindowBuffer objects 9 10 #ifndef LIBANGLE_RENDERER_GL_EGL_ANDROID_NATIVEBUFFERIMAGESIBLINGANDROID_H_ 11 #define LIBANGLE_RENDERER_GL_EGL_ANDROID_NATIVEBUFFERIMAGESIBLINGANDROID_H_ 12 13 #include "libANGLE/renderer/gl/egl/ExternalImageSiblingEGL.h" 14 15 namespace rx 16 { 17 18 class NativeBufferImageSiblingAndroid : public ExternalImageSiblingEGL 19 { 20 public: 21 NativeBufferImageSiblingAndroid(EGLClientBuffer buffer, const egl::AttributeMap &attribs); 22 ~NativeBufferImageSiblingAndroid() override; 23 24 egl::Error initialize(const egl::Display *display) override; 25 26 // ExternalImageSiblingImpl interface 27 gl::Format getFormat() const override; 28 bool isRenderable(const gl::Context *context) const override; 29 bool isTexturable(const gl::Context *context) const override; 30 bool isYUV() const override; 31 bool hasProtectedContent() const override; 32 gl::Extents getSize() const override; 33 size_t getSamples() const override; 34 35 // ExternalImageSiblingEGL interface 36 EGLClientBuffer getBuffer() const override; 37 void getImageCreationAttributes(std::vector<EGLint> *outAttributes) const override; 38 39 private: 40 EGLClientBuffer mBuffer; 41 gl::Extents mSize; 42 gl::Format mFormat; 43 bool mYUV; 44 bool mHasProtectedContent; 45 GLint mColorSpace; 46 }; 47 48 } // namespace rx 49 50 #endif // LIBANGLE_RENDERER_GL_EGL_ANDROID_NATIVEBUFFERIMAGESIBLINGANDROID_H_ 51