blob: e33823e96b9e80dad70b0318d37d3a0a578309ea [file] [log] [blame]
Romain Guy08aa2cb2011-03-17 11:06:57 -07001/*
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_DRAW_GL_INFO_H
18#define ANDROID_HWUI_DRAW_GL_INFO_H
19
20namespace android {
21namespace uirenderer {
22
23/**
24 * Structure used by OpenGLRenderer::callDrawGLFunction() to pass and
25 * receive data from OpenGL functors.
26 */
27struct DrawGlInfo {
28 // Input: current clip rect
29 int clipLeft;
30 int clipTop;
31 int clipRight;
32 int clipBottom;
33
Teng-Hui Zhu3d7f0cb2012-04-12 09:57:04 -070034 // Input: current width/height of destination surface
35 int width;
36 int height;
37
Romain Guy08aa2cb2011-03-17 11:06:57 -070038 // Input: is the render target an FBO
39 bool isLayer;
40
41 // Input: current transform matrix, in OpenGL format
42 float transform[16];
43
44 // Output: dirty region to redraw
45 float dirtyLeft;
46 float dirtyTop;
47 float dirtyRight;
48 float dirtyBottom;
Chris Craikc70e89e2012-04-03 13:53:46 -070049
50 /**
51 * Values used as the "what" parameter of the functor.
52 */
53 enum Mode {
54 // Indicates that the functor is called to perform a draw
55 kModeDraw,
56 // Indicates the the functor is called only to perform
57 // processing and that no draw should be attempted
58 kModeProcess
59 };
60
61 /**
62 * Values used by OpenGL functors to tell the framework
63 * what to do next.
64 */
65 enum Status {
66 // The functor is done
67 kStatusDone = 0x0,
68 // The functor is requesting a redraw (the clip rect
69 // used by the redraw is specified by DrawGlInfo.)
70 // The rest of the UI might redraw too.
71 kStatusDraw = 0x1,
72 // The functor needs to be invoked again but will
73 // not redraw. Only the functor is invoked again
74 // (unless another functor requests a redraw.)
75 kStatusInvoke = 0x2
76 };
Romain Guy08aa2cb2011-03-17 11:06:57 -070077}; // struct DrawGlInfo
78
79}; // namespace uirenderer
80}; // namespace android
81
82#endif // ANDROID_HWUI_DRAW_GL_INFO_H