blob: 1ae7e09cba5b1c066f62d9b565cae77ba397166d [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;
32 virtual bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected,
33 int32_t cropWidth, int32_t cropHeight) = 0;
34};
35
36namespace impl {
37
38class RenderEngine;
39
40class Image : public RE::Image {
41public:
42 explicit Image(const RenderEngine& engine);
43 ~Image() override;
Chia-I Wu401ef832017-12-01 10:52:22 -080044
45 Image(const Image&) = delete;
46 Image& operator=(const Image&) = delete;
47
48 bool setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected, int32_t cropWidth,
Lloyd Pique144e1162017-12-20 16:44:52 -080049 int32_t cropHeight) override;
Chia-I Wu401ef832017-12-01 10:52:22 -080050
51private:
52 // methods internal to RenderEngine
Lloyd Pique144e1162017-12-20 16:44:52 -080053 friend class RenderEngine;
Chia-I Wu401ef832017-12-01 10:52:22 -080054 EGLSurface getEGLImage() const { return mEGLImage; }
55
56 EGLDisplay mEGLDisplay;
57 EGLImageKHR mEGLImage = EGL_NO_IMAGE_KHR;
58};
59
Lloyd Pique144e1162017-12-20 16:44:52 -080060} // namespace impl
Chia-I Wu401ef832017-12-01 10:52:22 -080061} // namespace RE
62} // namespace android