Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <cstdint> |
| 20 | |
| 21 | #include <EGL/egl.h> |
| 22 | #include <EGL/eglext.h> |
| 23 | |
| 24 | struct ANativeWindowBuffer; |
| 25 | |
| 26 | namespace android { |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 27 | namespace RE { |
| 28 | |
| 29 | class Image { |
| 30 | public: |
Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 31 | virtual ~Image() = 0; |
Krzysztof Kosiński | 7108c31 | 2018-06-27 19:12:54 -0700 | [diff] [blame] | 32 | virtual bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected) = 0; |
Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | namespace impl { |
| 36 | |
| 37 | class RenderEngine; |
| 38 | |
| 39 | class Image : public RE::Image { |
| 40 | public: |
| 41 | explicit Image(const RenderEngine& engine); |
| 42 | ~Image() override; |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 43 | |
| 44 | Image(const Image&) = delete; |
| 45 | Image& operator=(const Image&) = delete; |
| 46 | |
Krzysztof Kosiński | 7108c31 | 2018-06-27 19:12:54 -0700 | [diff] [blame] | 47 | bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected) override; |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 48 | |
| 49 | private: |
| 50 | // methods internal to RenderEngine |
Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 51 | friend class RenderEngine; |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 52 | EGLSurface getEGLImage() const { return mEGLImage; } |
| 53 | |
| 54 | EGLDisplay mEGLDisplay; |
| 55 | EGLImageKHR mEGLImage = EGL_NO_IMAGE_KHR; |
| 56 | }; |
| 57 | |
Lloyd Pique | 144e116 | 2017-12-20 16:44:52 -0800 | [diff] [blame] | 58 | } // namespace impl |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 59 | } // namespace RE |
| 60 | } // namespace android |