• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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_SF_LAYER_STATE_H
18 #define ANDROID_SF_LAYER_STATE_H
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #include <utils/Errors.h>
24 
25 #include <ui/Region.h>
26 #include <ui/Rect.h>
27 
28 namespace android {
29 
30 class Parcel;
31 class ISurfaceComposerClient;
32 
33 struct layer_state_t {
34 
35 
36     enum {
37         eLayerHidden        = 0x01,
38     };
39 
40     enum {
41         ePositionChanged            = 0x00000001,
42         eLayerChanged               = 0x00000002,
43         eSizeChanged                = 0x00000004,
44         eAlphaChanged               = 0x00000008,
45         eMatrixChanged              = 0x00000010,
46         eTransparentRegionChanged   = 0x00000020,
47         eVisibilityChanged          = 0x00000040,
48         eLayerStackChanged          = 0x00000080,
49         eCropChanged                = 0x00000100,
50     };
51 
layer_state_tlayer_state_t52     layer_state_t()
53         :   what(0),
54             x(0), y(0), z(0), w(0), h(0), layerStack(0),
55             alpha(0), flags(0), mask(0),
56             reserved(0)
57     {
58         matrix.dsdx = matrix.dtdy = 1.0f;
59         matrix.dsdy = matrix.dtdx = 0.0f;
60         crop.makeInvalid();
61     }
62 
63     status_t    write(Parcel& output) const;
64     status_t    read(const Parcel& input);
65 
66             struct matrix22_t {
67                 float   dsdx;
68                 float   dtdx;
69                 float   dsdy;
70                 float   dtdy;
71             };
72             sp<IBinder>     surface;
73             uint32_t        what;
74             float           x;
75             float           y;
76             uint32_t        z;
77             uint32_t        w;
78             uint32_t        h;
79             uint32_t        layerStack;
80             float           alpha;
81             uint8_t         flags;
82             uint8_t         mask;
83             uint8_t         reserved;
84             matrix22_t      matrix;
85             Rect            crop;
86             // non POD must be last. see write/read
87             Region          transparentRegion;
88 };
89 
90 struct ComposerState {
91     sp<ISurfaceComposerClient> client;
92     layer_state_t state;
93     status_t    write(Parcel& output) const;
94     status_t    read(const Parcel& input);
95 };
96 
97 struct DisplayState {
98 
99     enum {
100         eOrientationDefault     = 0,
101         eOrientation90          = 1,
102         eOrientation180         = 2,
103         eOrientation270         = 3,
104         eOrientationUnchanged   = 4,
105         eOrientationSwapMask    = 0x01
106     };
107 
108     enum {
109         eSurfaceChanged             = 0x01,
110         eLayerStackChanged          = 0x02,
111         eDisplayProjectionChanged   = 0x04
112     };
113 
114     uint32_t what;
115     sp<IBinder> token;
116     sp<IGraphicBufferProducer> surface;
117     uint32_t layerStack;
118     uint32_t orientation;
119     Rect viewport;
120     Rect frame;
121     status_t write(Parcel& output) const;
122     status_t read(const Parcel& input);
123 };
124 
125 }; // namespace android
126 
127 #endif // ANDROID_SF_LAYER_STATE_H
128 
129