Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 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 | |
| 22 | namespace android { |
| 23 | namespace uirenderer { |
| 24 | |
| 25 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame^] | 26 | // 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 Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 37 | // Renderer |
| 38 | /////////////////////////////////////////////////////////////////////////////// |
| 39 | |
| 40 | class LayerRenderer: public OpenGLRenderer { |
| 41 | public: |
| 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 Guy | 57066eb | 2011-01-12 12:53:32 -0800 | [diff] [blame] | 56 | static void destroyLayerDeferred(GLuint fbo, GLuint texture); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 57 | |
| 58 | private: |
| 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 |