1/*
2* Copyright (C) 2011 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#ifndef _RENDERER_SURFACE_H_
17#define _RENDERER_SURFACE_H_
18
19#include <EGL/egl.h>
20#include "NativeWindowing.h"
21#include "RendererObject.h"
22
23#define DEFAULT_HEIGHT 480
24#define DEFAULT_WIDTH 320
25
26class RendererSurface : public RendererObject {
27public:
28    typedef enum { CONFIG_DEPTH = 1 << 0 } SurfaceConfig;
29
30    EGLSurface eglSurface() { return m_eglSurface; }
31    EGLConfig eglConfig() { return m_config; }
32    EGLDisplay eglDisplay() { return m_eglDisplay; }
33
34    static RendererSurface * create(EGLDisplay eglDisplay, SurfaceConfig config, NativeWindowing *nw);
35    static EGLConfig getEglConfig(EGLDisplay eglDisplay, SurfaceConfig config);
36
37    int destroy(NativeWindowing *nw);
38
39private:
40    RendererSurface(EGLDisplay display, NativeWindowType window, EGLSurface surface, EGLConfig config) :
41        m_eglDisplay(display),
42        m_config(config),
43        m_window(window),
44        m_eglSurface(surface)
45    {}
46
47    EGLDisplay m_eglDisplay;
48    EGLConfig m_config;
49    NativeWindowType m_window;
50    EGLSurface m_eglSurface;
51};
52#endif
53