1ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/*
2ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Copyright (C) 2011 The Android Open Source Project
3ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall*
4ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Licensed under the Apache License, Version 2.0 (the "License");
5ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* you may not use this file except in compliance with the License.
6ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* You may obtain a copy of the License at
7ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall*
8ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* http://www.apache.org/licenses/LICENSE-2.0
9ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall*
10ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Unless required by applicable law or agreed to in writing, software
11ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* distributed under the License is distributed on an "AS IS" BASIS,
12ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* See the License for the specific language governing permissions and
14ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* limitations under the License.
15ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall*/
16ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#ifndef _RENDERER_SURFACE_H_
17ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define _RENDERER_SURFACE_H_
18ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
19ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <EGL/egl.h>
20ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include "NativeWindowing.h"
21ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include "RendererObject.h"
22ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
23ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define DEFAULT_HEIGHT 480
24ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define DEFAULT_WIDTH 320
25ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
26ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallclass RendererSurface : public RendererObject {
27ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallpublic:
28ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    typedef enum { CONFIG_DEPTH = 1 << 0 } SurfaceConfig;
29ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
30ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLSurface eglSurface() { return m_eglSurface; }
31ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLConfig eglConfig() { return m_config; }
32ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLDisplay eglDisplay() { return m_eglDisplay; }
33ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
34ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    static RendererSurface * create(EGLDisplay eglDisplay, SurfaceConfig config, NativeWindowing *nw);
35ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    static EGLConfig getEglConfig(EGLDisplay eglDisplay, SurfaceConfig config);
36ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
37ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    int destroy(NativeWindowing *nw);
38ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
39ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallprivate:
40ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    RendererSurface(EGLDisplay display, NativeWindowType window, EGLSurface surface, EGLConfig config) :
41ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall        m_eglDisplay(display),
42ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall        m_config(config),
43ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall        m_window(window),
44ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall        m_eglSurface(surface)
45ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    {}
46ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall
47ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLDisplay m_eglDisplay;
48ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLConfig m_config;
49ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    NativeWindowType m_window;
50ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall    EGLSurface m_eglSurface;
51ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall};
52ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#endif
53