blob: be684122f80ae459996636f70b2deaafe24c2099 [file] [log] [blame]
Romain Guy6c319ca2011-01-11 14:29:25 -08001/*
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///////////////////////////////////////////////////////////////////////////////
Romain Guy1fc883b2011-01-12 14:30:59 -080026// Defines
27///////////////////////////////////////////////////////////////////////////////
28
29// Debug
30#if DEBUG_LAYER_RENDERER
31 #define LAYER_RENDERER_LOGD(...) LOGD(__VA_ARGS__)
32#else
33 #define LAYER_RENDERER_LOGD(...)
34#endif
35
36///////////////////////////////////////////////////////////////////////////////
Romain Guy6c319ca2011-01-11 14:29:25 -080037// Renderer
38///////////////////////////////////////////////////////////////////////////////
39
40class LayerRenderer: public OpenGLRenderer {
41public:
42 LayerRenderer(GLuint fbo): mFbo(fbo) {
43 }
44
45 ~LayerRenderer() {
46 }
47
48 void prepare(bool opaque);
49 void finish();
50
51 static GLuint createLayer(uint32_t width, uint32_t height,
52 uint32_t* layerWidth, uint32_t* layerHeight, GLuint* texture);
53 static void resizeLayer(GLuint fbo, GLuint texture, uint32_t width, uint32_t height,
54 uint32_t* layerWidth, uint32_t* layerHeight);
55 static void destroyLayer(GLuint fbo, GLuint texture);
Romain Guy57066eb2011-01-12 12:53:32 -080056 static void destroyLayerDeferred(GLuint fbo, GLuint texture);
Romain Guy6c319ca2011-01-11 14:29:25 -080057
58private:
59 GLuint mFbo;
60 GLuint mPreviousFbo;
61
62}; // class LayerRenderer
63
64}; // namespace uirenderer
65}; // namespace android
66
67#endif // ANDROID_HWUI_LAYER_RENDERER_H