blob: c38fe0a2ff18c757451b92c6d862231b5e6f9483 [file] [log] [blame]
Chia-I Wu401ef832017-12-01 10:52:22 -08001/*
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
24struct ANativeWindowBuffer;
25
26namespace android {
Chia-I Wu401ef832017-12-01 10:52:22 -080027namespace RE {
28
29class Image {
30public:
Lloyd Pique144e1162017-12-20 16:44:52 -080031 virtual ~Image() = 0;
Krzysztof Kosiński7108c312018-06-27 19:12:54 -070032 virtual bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected) = 0;
Lloyd Pique144e1162017-12-20 16:44:52 -080033};
34
35namespace impl {
36
37class RenderEngine;
38
39class Image : public RE::Image {
40public:
41 explicit Image(const RenderEngine& engine);
42 ~Image() override;
Chia-I Wu401ef832017-12-01 10:52:22 -080043
44 Image(const Image&) = delete;
45 Image& operator=(const Image&) = delete;
46
Krzysztof Kosiński7108c312018-06-27 19:12:54 -070047 bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected) override;
Chia-I Wu401ef832017-12-01 10:52:22 -080048
49private:
50 // methods internal to RenderEngine
Lloyd Pique144e1162017-12-20 16:44:52 -080051 friend class RenderEngine;
Chia-I Wu401ef832017-12-01 10:52:22 -080052 EGLSurface getEGLImage() const { return mEGLImage; }
53
54 EGLDisplay mEGLDisplay;
55 EGLImageKHR mEGLImage = EGL_NO_IMAGE_KHR;
56};
57
Lloyd Pique144e1162017-12-20 16:44:52 -080058} // namespace impl
Chia-I Wu401ef832017-12-01 10:52:22 -080059} // namespace RE
60} // namespace android