2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_HWUI_LAYER_RENDERER_H
18 #define ANDROID_HWUI_LAYER_RENDERER_H
20 #include <cutils/compiler.h>
22 #include "OpenGLRenderer.h"
28 namespace uirenderer {
30 ///////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////
35 #if DEBUG_LAYER_RENDERER
36 #define LAYER_RENDERER_LOGD(...) LOGD(__VA_ARGS__)
38 #define LAYER_RENDERER_LOGD(...)
41 ///////////////////////////////////////////////////////////////////////////////
43 ///////////////////////////////////////////////////////////////////////////////
45 class LayerRenderer: public OpenGLRenderer {
47 ANDROID_API LayerRenderer(Layer* layer);
48 virtual ~LayerRenderer();
50 virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
51 virtual void finish();
53 virtual bool hasLayer();
54 virtual Region* getRegion();
55 virtual GLint getTargetFbo();
57 ANDROID_API static Layer* createTextureLayer(bool isOpaque);
58 ANDROID_API static Layer* createLayer(uint32_t width, uint32_t height, bool isOpaque = false);
59 ANDROID_API static bool resizeLayer(Layer* layer, uint32_t width, uint32_t height);
60 ANDROID_API static void updateTextureLayer(Layer* layer, uint32_t width, uint32_t height,
61 bool isOpaque, GLenum renderTarget, float* transform);
62 ANDROID_API static void destroyLayer(Layer* layer);
63 ANDROID_API static void destroyLayerDeferred(Layer* layer);
64 ANDROID_API static bool copyLayer(Layer* layer, SkBitmap* bitmap);
70 }; // class LayerRenderer
72 }; // namespace uirenderer
73 }; // namespace android
75 #endif // ANDROID_HWUI_LAYER_RENDERER_H