blob: ed5d9609c0011dfc4f1cde00fdf40a4e6519fe17 [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"
Romain Guyada830f2011-01-13 12:13:20 -080021#include "Layer.h"
Romain Guy6c319ca2011-01-11 14:29:25 -080022
23namespace android {
24namespace uirenderer {
25
26///////////////////////////////////////////////////////////////////////////////
Romain Guy1fc883b2011-01-12 14:30:59 -080027// Defines
28///////////////////////////////////////////////////////////////////////////////
29
30// Debug
31#if DEBUG_LAYER_RENDERER
32 #define LAYER_RENDERER_LOGD(...) LOGD(__VA_ARGS__)
33#else
34 #define LAYER_RENDERER_LOGD(...)
35#endif
36
37///////////////////////////////////////////////////////////////////////////////
Romain Guy6c319ca2011-01-11 14:29:25 -080038// Renderer
39///////////////////////////////////////////////////////////////////////////////
40
41class LayerRenderer: public OpenGLRenderer {
42public:
Romain Guyada830f2011-01-13 12:13:20 -080043 LayerRenderer(Layer* layer): mLayer(layer) {
Romain Guy6c319ca2011-01-11 14:29:25 -080044 }
45
46 ~LayerRenderer() {
47 }
48
49 void prepare(bool opaque);
50 void finish();
51
Romain Guyada830f2011-01-13 12:13:20 -080052 static Layer* createLayer(uint32_t width, uint32_t height, bool isOpaque = false);
53 static bool resizeLayer(Layer* layer, uint32_t width, uint32_t height);
54 static void destroyLayer(Layer* layer);
55 static void destroyLayerDeferred(Layer* layer);
Romain Guy6c319ca2011-01-11 14:29:25 -080056
57private:
Romain Guyada830f2011-01-13 12:13:20 -080058 Layer* mLayer;
Romain Guy6c319ca2011-01-11 14:29:25 -080059 GLuint mPreviousFbo;
60
61}; // class LayerRenderer
62
63}; // namespace uirenderer
64}; // namespace android
65
66#endif // ANDROID_HWUI_LAYER_RENDERER_H