LayerRenderer.h revision 6c319ca1275c8db892c39b48fc54864c949f9171
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
17#ifndef ANDROID_HWUI_LAYER_RENDERER_H
18#define ANDROID_HWUI_LAYER_RENDERER_H
19
20#include "OpenGLRenderer.h"
21
22namespace android {
23namespace uirenderer {
24
25///////////////////////////////////////////////////////////////////////////////
26// Renderer
27///////////////////////////////////////////////////////////////////////////////
28
29class LayerRenderer: public OpenGLRenderer {
30public:
31    LayerRenderer(GLuint fbo): mFbo(fbo) {
32    }
33
34    ~LayerRenderer() {
35    }
36
37    void prepare(bool opaque);
38    void finish();
39
40    static GLuint createLayer(uint32_t width, uint32_t height,
41            uint32_t* layerWidth, uint32_t* layerHeight, GLuint* texture);
42    static void resizeLayer(GLuint fbo, GLuint texture, uint32_t width, uint32_t height,
43            uint32_t* layerWidth, uint32_t* layerHeight);
44    static void destroyLayer(GLuint fbo, GLuint texture);
45
46private:
47    GLuint mFbo;
48    GLuint mPreviousFbo;
49
50}; // class LayerRenderer
51
52}; // namespace uirenderer
53}; // namespace android
54
55#endif // ANDROID_HWUI_LAYER_RENDERER_H
56