1/*
2 * Copyright (C) 2012 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#include <stdint.h>
18
19#include <EGL/egl.h>
20#include <GLES2/gl2.h>
21
22#include <gui/GLConsumer.h>
23
24namespace android {
25
26#define NELEMS(x) ((int) (sizeof(x) / sizeof((x)[0])))
27
28enum { MAX_NUM_LAYERS = 16 };
29enum { MAX_TEST_RUNS = 16 };
30
31class Composer;
32class Renderer;
33class GLHelper;
34
35struct LayerDesc {
36    uint32_t flags;
37    Renderer* (*rendererFactory)();
38    Composer* (*composerFactory)();
39    int32_t x;
40    int32_t y;
41    uint32_t width;
42    uint32_t height;
43};
44
45void resetColorGenerator();
46
47class Composer {
48public:
49    virtual ~Composer() {}
50    virtual bool setUp(const LayerDesc& desc, GLHelper* helper) = 0;
51    virtual void tearDown() = 0;
52    virtual bool compose(GLuint texName, const sp<GLConsumer>& glc) = 0;
53};
54
55Composer* nocomp();
56Composer* opaque();
57Composer* opaqueShrink();
58Composer* blend();
59Composer* blendShrink();
60
61class Renderer {
62public:
63    virtual ~Renderer() {}
64    virtual bool setUp(GLHelper* helper) = 0;
65    virtual void tearDown() = 0;
66    virtual bool render(EGLSurface surface) = 0;
67};
68
69Renderer* staticGradient();
70
71} // namespace android
72